@splitsoftware/splitio-commons 1.10.1-rc.0 → 1.10.1-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.
- package/CHANGES.txt +9 -0
- package/cjs/logger/constants.js +2 -3
- package/cjs/logger/messages/warn.js +0 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +15 -1
- package/esm/logger/constants.js +0 -1
- package/esm/logger/messages/warn.js +0 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +15 -1
- package/package.json +1 -1
- package/src/logger/constants.ts +0 -1
- package/src/logger/messages/warn.ts +0 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +13 -2
- package/src/types.ts +3 -3
- package/types/logger/constants.d.ts +0 -1
- package/types/types.d.ts +2 -2
package/CHANGES.txt
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
1.11.0 (November XX, 2023)
|
|
2
|
+
- Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation):
|
|
3
|
+
- Added new variations of the get treatment methods to support evaluating flags in given flag set/s.
|
|
4
|
+
- getTreatmentsByFlagSet and getTreatmentsByFlagSets
|
|
5
|
+
- getTreatmentsWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets
|
|
6
|
+
- Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload.
|
|
7
|
+
- Note: Only applicable when the SDK is in charge of the rollout data synchronization. When not applicable, the SDK will log a warning on init.
|
|
8
|
+
- Added `sets` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager to expose flag sets on flag views.
|
|
9
|
+
|
|
1
10
|
1.10.0 (October 20, 2023)
|
|
2
11
|
- Added `defaultTreatment` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager (Related to issue https://github.com/splitio/javascript-commons/issues/225).
|
|
3
12
|
- Updated log warning message to include the feature flag name when `getTreatment` method is called and the SDK client is not ready.
|
package/cjs/logger/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SYNC_SPLITS_FETCH_RETRY = exports.POLLING_STOP = exports.POLLING_START = exports.POLLING_SMART_PAUSING = exports.NEW_FACTORY = exports.NEW_SHARED_CLIENT = exports.IMPRESSION_QUEUEING = exports.IMPRESSION = exports.CLIENT_READY = exports.CLIENT_READY_FROM_CACHE = exports.SETTINGS_SPLITS_FILTER = exports.SYNC_TASK_STOP = exports.SYNC_TASK_EXECUTE = exports.SYNC_TASK_START = exports.STREAMING_NEW_MESSAGE = exports.SYNC_SPLITS_SEGMENTS = exports.SYNC_SPLITS_REMOVED = exports.SYNC_SPLITS_NEW = exports.SYNC_SPLITS_FETCH = exports.SYNC_OFFLINE_DATA = exports.RETRIEVE_MANAGER = exports.RETRIEVE_CLIENT_EXISTING = exports.RETRIEVE_CLIENT_DEFAULT = exports.CLEANUP_DEREGISTERING = exports.CLEANUP_REGISTERING = exports.ENGINE_SANITIZE = exports.ENGINE_VALUE = exports.ENGINE_MATCHER_WHITELIST = exports.ENGINE_MATCHER_STARTS_WITH = exports.ENGINE_MATCHER_STRING_INVALID = exports.ENGINE_MATCHER_STRING = exports.ENGINE_MATCHER_SEGMENT = exports.ENGINE_MATCHER_PART_OF = exports.ENGINE_MATCHER_LESS = exports.ENGINE_MATCHER_GREATER = exports.ENGINE_MATCHER_ENDS_WITH = exports.ENGINE_MATCHER_EQUAL_TO_SET = exports.ENGINE_MATCHER_EQUAL = exports.ENGINE_MATCHER_DEPENDENCY_PRE = exports.ENGINE_MATCHER_DEPENDENCY = exports.ENGINE_MATCHER_CONTAINS_STRING = exports.ENGINE_MATCHER_CONTAINS_ANY = exports.ENGINE_MATCHER_CONTAINS_ALL = exports.ENGINE_MATCHER_BOOLEAN = exports.ENGINE_MATCHER_BETWEEN = exports.ENGINE_MATCHER_ALL = exports.ENGINE_BUCKET = exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = exports.ENGINE_COMBINER_IFELSEIF = exports.ENGINE_COMBINER_AND = void 0;
|
|
4
|
-
exports.ERROR_STREAMING_AUTH = exports.ERROR_STREAMING_SSE = exports.ERROR_SYNC_OFFLINE_LOADING = exports.ERROR_CLIENT_CANNOT_GET_READY = exports.ERROR_CLIENT_LISTENER = exports.ERROR_LOGLEVEL_INVALID = exports.ERROR_ENGINE_COMBINER_IFELSEIF = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_SPLITS_FILTER_LOWERCASE_SET = exports.WARN_SPLITS_FILTER_INVALID_SET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.
|
|
5
|
-
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC = exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = exports.ERROR_STORAGE_INVALID = exports.ERROR_LOCALHOST_MODULE_REQUIRED = exports.ERROR_HTTP = exports.ERROR_INVALID_CONFIG_PARAM = exports.ERROR_EMPTY_ARRAY = exports.ERROR_EMPTY = exports.ERROR_INVALID = exports.ERROR_INVALID_KEY_OBJECT = exports.ERROR_TOO_LONG = exports.ERROR_NULL = exports.ERROR_CLIENT_DESTROYED = exports.ERROR_NOT_FINITE = exports.ERROR_SIZE_EXCEEDED = exports.ERROR_NOT_PLAIN_OBJECT = exports.ERROR_EVENT_TYPE_FORMAT = exports.ERROR_EVENTS_TRACKER = exports.ERROR_IMPRESSIONS_LISTENER =
|
|
4
|
+
exports.ERROR_IMPRESSIONS_TRACKER = exports.ERROR_STREAMING_AUTH = exports.ERROR_STREAMING_SSE = exports.ERROR_SYNC_OFFLINE_LOADING = exports.ERROR_CLIENT_CANNOT_GET_READY = exports.ERROR_CLIENT_LISTENER = exports.ERROR_LOGLEVEL_INVALID = exports.ERROR_ENGINE_COMBINER_IFELSEIF = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_SPLITS_FILTER_LOWERCASE_SET = exports.WARN_SPLITS_FILTER_INVALID_SET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.WARN_INTEGRATION_INVALID = exports.WARN_NOT_EXISTENT_TT = exports.WARN_LOWERCASE_TRAFFIC_TYPE = exports.WARN_NOT_EXISTENT_SPLIT = exports.WARN_TRIMMING = exports.WARN_CONVERTING = exports.WARN_TRIMMING_PROPERTIES = exports.WARN_SETTING_NULL = exports.SUBMITTERS_PUSH_RETRY = exports.SUBMITTERS_PUSH_FAILS = exports.STREAMING_FALLBACK = exports.STREAMING_PARSING_MESSAGE_FAILS = exports.STREAMING_PARSING_ERROR_FAILS = exports.SYNC_SPLITS_FETCH_FAILS = exports.SYNC_MYSEGMENTS_FETCH_RETRY = exports.CLIENT_NOT_READY = exports.CLIENT_NO_LISTENER = exports.ENGINE_VALUE_NO_ATTRIBUTES = exports.ENGINE_VALUE_INVALID = exports.USER_CONSENT_INITIAL = exports.USER_CONSENT_NOT_UPDATED = exports.USER_CONSENT_UPDATED = exports.IMPRESSIONS_TRACKER_SUCCESS = exports.EVENTS_TRACKER_SUCCESS = exports.SYNC_STOP_POLLING = exports.SYNC_CONTINUE_POLLING = exports.SYNC_START_POLLING = exports.SUBMITTERS_PUSH = exports.SUBMITTERS_PUSH_FULL_QUEUE = exports.STREAMING_DISCONNECTING = exports.STREAMING_DISABLED = exports.STREAMING_CONNECTING = exports.STREAMING_RECONNECT = exports.STREAMING_REFRESH_TOKEN = void 0;
|
|
5
|
+
exports.LOG_PREFIX_CLEANUP = exports.LOG_PREFIX_UNIQUE_KEYS_TRACKER = exports.LOG_PREFIX_EVENTS_TRACKER = exports.LOG_PREFIX_IMPRESSIONS_TRACKER = exports.LOG_PREFIX_SYNC_SUBMITTERS = exports.LOG_PREFIX_SYNC_POLLING = exports.LOG_PREFIX_SYNC_MYSEGMENTS = exports.LOG_PREFIX_SYNC_SEGMENTS = exports.LOG_PREFIX_SYNC_SPLITS = exports.LOG_PREFIX_SYNC_STREAMING = exports.LOG_PREFIX_SYNC_OFFLINE = exports.LOG_PREFIX_SYNC_MANAGER = exports.LOG_PREFIX_SYNC = exports.LOG_PREFIX_ENGINE_VALUE = exports.LOG_PREFIX_ENGINE_MATCHER = exports.LOG_PREFIX_ENGINE_COMBINER = exports.LOG_PREFIX_ENGINE = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = exports.ERROR_STORAGE_INVALID = exports.ERROR_LOCALHOST_MODULE_REQUIRED = exports.ERROR_HTTP = exports.ERROR_INVALID_CONFIG_PARAM = exports.ERROR_EMPTY_ARRAY = exports.ERROR_EMPTY = exports.ERROR_INVALID = exports.ERROR_INVALID_KEY_OBJECT = exports.ERROR_TOO_LONG = exports.ERROR_NULL = exports.ERROR_CLIENT_DESTROYED = exports.ERROR_NOT_FINITE = exports.ERROR_SIZE_EXCEEDED = exports.ERROR_NOT_PLAIN_OBJECT = exports.ERROR_EVENT_TYPE_FORMAT = exports.ERROR_EVENTS_TRACKER = exports.ERROR_IMPRESSIONS_LISTENER = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* Message codes used to trim string log messages from commons and client-side API modules,
|
|
8
8
|
* in order to reduce the minimal SDK size for Browser and eventually other client-side environments.
|
|
@@ -94,7 +94,6 @@ exports.WARN_NOT_EXISTENT_SPLIT = 215;
|
|
|
94
94
|
exports.WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
95
95
|
exports.WARN_NOT_EXISTENT_TT = 217;
|
|
96
96
|
exports.WARN_INTEGRATION_INVALID = 218;
|
|
97
|
-
exports.WARN_SPLITS_FILTER_IGNORED = 219;
|
|
98
97
|
exports.WARN_SPLITS_FILTER_INVALID = 220;
|
|
99
98
|
exports.WARN_SPLITS_FILTER_EMPTY = 221;
|
|
100
99
|
exports.WARN_SDK_KEY = 222;
|
|
@@ -30,7 +30,6 @@ exports.codesWarn = error_1.codesError.concat([
|
|
|
30
30
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: : you passed %s wich is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
31
31
|
// initialization / settings validation
|
|
32
32
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
33
|
-
[c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS + ': feature flag filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
|
|
34
33
|
[c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS + ': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],
|
|
35
34
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
36
35
|
[c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
|
|
@@ -99,6 +99,17 @@ function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, segments,
|
|
|
99
99
|
promise = (0, timeout_1.timeout)(requestTimeoutBeforeReady, promise);
|
|
100
100
|
return promise;
|
|
101
101
|
}
|
|
102
|
+
/** Returns true if at least one split was updated */
|
|
103
|
+
function update(flagsChange) {
|
|
104
|
+
var added = flagsChange[1], removed = flagsChange[2];
|
|
105
|
+
// There is at least one added or modified feature flag
|
|
106
|
+
if (added && added.some(function (update) { return update; }))
|
|
107
|
+
return true;
|
|
108
|
+
// There is at least one removed feature flag
|
|
109
|
+
if (removed && removed.some(function (update) { return update; }))
|
|
110
|
+
return true;
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
102
113
|
/**
|
|
103
114
|
* SplitChanges updater returns a promise that resolves with a `false` boolean value if it fails to fetch splits or synchronize them with the storage.
|
|
104
115
|
* Returned promise will not be rejected.
|
|
@@ -131,7 +142,10 @@ function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, segments,
|
|
|
131
142
|
splits.addSplits(mutation.added),
|
|
132
143
|
splits.removeSplits(mutation.removed),
|
|
133
144
|
segments.registerSegments(mutation.segments)
|
|
134
|
-
]).then(function () {
|
|
145
|
+
]).then(function (flagsChange) {
|
|
146
|
+
var triggerSdkUpdate = update(flagsChange);
|
|
147
|
+
if (!triggerSdkUpdate)
|
|
148
|
+
return true;
|
|
135
149
|
if (splitsEventEmitter) {
|
|
136
150
|
// To emit SDK_SPLITS_ARRIVED for server-side SDK, we must check that all registered segments have been fetched
|
|
137
151
|
return Promise.resolve(!splitsEventEmitter.splitsArrived || (since !== splitChanges.till && (isClientSide || checkAllSegmentsExist(segments))))
|
package/esm/logger/constants.js
CHANGED
|
@@ -89,7 +89,6 @@ export var WARN_NOT_EXISTENT_SPLIT = 215;
|
|
|
89
89
|
export var WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
90
90
|
export var WARN_NOT_EXISTENT_TT = 217;
|
|
91
91
|
export var WARN_INTEGRATION_INVALID = 218;
|
|
92
|
-
export var WARN_SPLITS_FILTER_IGNORED = 219;
|
|
93
92
|
export var WARN_SPLITS_FILTER_INVALID = 220;
|
|
94
93
|
export var WARN_SPLITS_FILTER_EMPTY = 221;
|
|
95
94
|
export var WARN_SDK_KEY = 222;
|
|
@@ -26,7 +26,6 @@ export var codesWarn = codesError.concat([
|
|
|
26
26
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: : you passed %s wich is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
27
27
|
// initialization / settings validation
|
|
28
28
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
29
|
-
[c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS + ': feature flag filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
|
|
30
29
|
[c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS + ': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],
|
|
31
30
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
32
31
|
[c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
|
|
@@ -94,6 +94,17 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, seg
|
|
|
94
94
|
promise = timeout(requestTimeoutBeforeReady, promise);
|
|
95
95
|
return promise;
|
|
96
96
|
}
|
|
97
|
+
/** Returns true if at least one split was updated */
|
|
98
|
+
function update(flagsChange) {
|
|
99
|
+
var added = flagsChange[1], removed = flagsChange[2];
|
|
100
|
+
// There is at least one added or modified feature flag
|
|
101
|
+
if (added && added.some(function (update) { return update; }))
|
|
102
|
+
return true;
|
|
103
|
+
// There is at least one removed feature flag
|
|
104
|
+
if (removed && removed.some(function (update) { return update; }))
|
|
105
|
+
return true;
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
97
108
|
/**
|
|
98
109
|
* SplitChanges updater returns a promise that resolves with a `false` boolean value if it fails to fetch splits or synchronize them with the storage.
|
|
99
110
|
* Returned promise will not be rejected.
|
|
@@ -126,7 +137,10 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, seg
|
|
|
126
137
|
splits.addSplits(mutation.added),
|
|
127
138
|
splits.removeSplits(mutation.removed),
|
|
128
139
|
segments.registerSegments(mutation.segments)
|
|
129
|
-
]).then(function () {
|
|
140
|
+
]).then(function (flagsChange) {
|
|
141
|
+
var triggerSdkUpdate = update(flagsChange);
|
|
142
|
+
if (!triggerSdkUpdate)
|
|
143
|
+
return true;
|
|
130
144
|
if (splitsEventEmitter) {
|
|
131
145
|
// To emit SDK_SPLITS_ARRIVED for server-side SDK, we must check that all registered segments have been fetched
|
|
132
146
|
return Promise.resolve(!splitsEventEmitter.splitsArrived || (since !== splitChanges.till && (isClientSide || checkAllSegmentsExist(segments))))
|
package/package.json
CHANGED
package/src/logger/constants.ts
CHANGED
|
@@ -91,7 +91,6 @@ export const WARN_NOT_EXISTENT_SPLIT = 215;
|
|
|
91
91
|
export const WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
92
92
|
export const WARN_NOT_EXISTENT_TT = 217;
|
|
93
93
|
export const WARN_INTEGRATION_INVALID = 218;
|
|
94
|
-
export const WARN_SPLITS_FILTER_IGNORED = 219;
|
|
95
94
|
export const WARN_SPLITS_FILTER_INVALID = 220;
|
|
96
95
|
export const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
97
96
|
export const WARN_SDK_KEY = 222;
|
|
@@ -27,7 +27,6 @@ export const codesWarn: [number, string][] = codesError.concat([
|
|
|
27
27
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: : you passed %s wich is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
28
28
|
// initialization / settings validation
|
|
29
29
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS+': %s integration item(s) at settings is invalid. %s'],
|
|
30
|
-
[c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS+': feature flag filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
|
|
31
30
|
[c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS+': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("bySet", "byName" or "byPrefix") and a list of "values".'],
|
|
32
31
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS+': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
33
32
|
[c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS+': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
|
|
@@ -127,6 +127,16 @@ export function splitChangesUpdaterFactory(
|
|
|
127
127
|
return promise;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/** Returns true if at least one split was updated */
|
|
131
|
+
function update(flagsChange: [boolean | void, void | boolean[], void | boolean[], boolean | void] | [any, any, any]) {
|
|
132
|
+
const [, added, removed, ] = flagsChange;
|
|
133
|
+
// There is at least one added or modified feature flag
|
|
134
|
+
if (added && added.some((update: boolean) => update)) return true;
|
|
135
|
+
// There is at least one removed feature flag
|
|
136
|
+
if (removed && removed.some((update: boolean) => update)) return true;
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
|
|
130
140
|
/**
|
|
131
141
|
* SplitChanges updater returns a promise that resolves with a `false` boolean value if it fails to fetch splits or synchronize them with the storage.
|
|
132
142
|
* Returned promise will not be rejected.
|
|
@@ -163,8 +173,9 @@ export function splitChangesUpdaterFactory(
|
|
|
163
173
|
splits.addSplits(mutation.added),
|
|
164
174
|
splits.removeSplits(mutation.removed),
|
|
165
175
|
segments.registerSegments(mutation.segments)
|
|
166
|
-
]).then(() => {
|
|
167
|
-
|
|
176
|
+
]).then((flagsChange) => {
|
|
177
|
+
const triggerSdkUpdate = update(flagsChange);
|
|
178
|
+
if (!triggerSdkUpdate) return true;
|
|
168
179
|
if (splitsEventEmitter) {
|
|
169
180
|
// To emit SDK_SPLITS_ARRIVED for server-side SDK, we must check that all registered segments have been fetched
|
|
170
181
|
return Promise.resolve(!splitsEventEmitter.splitsArrived || (since !== splitChanges.till && (isClientSide || checkAllSegmentsExist(segments))))
|
package/src/types.ts
CHANGED
|
@@ -609,12 +609,12 @@ export namespace SplitIO {
|
|
|
609
609
|
*/
|
|
610
610
|
configs: {
|
|
611
611
|
[treatmentName: string]: string
|
|
612
|
-
}
|
|
612
|
+
},
|
|
613
613
|
/**
|
|
614
|
-
*
|
|
614
|
+
* List of sets of the feature flag.
|
|
615
615
|
* @property {string[]} sets
|
|
616
616
|
*/
|
|
617
|
-
sets
|
|
617
|
+
sets: string[],
|
|
618
618
|
/**
|
|
619
619
|
* The default treatment of the feature flag.
|
|
620
620
|
* @property {string} defaultTreatment
|
|
@@ -89,7 +89,6 @@ export declare const WARN_NOT_EXISTENT_SPLIT = 215;
|
|
|
89
89
|
export declare const WARN_LOWERCASE_TRAFFIC_TYPE = 216;
|
|
90
90
|
export declare const WARN_NOT_EXISTENT_TT = 217;
|
|
91
91
|
export declare const WARN_INTEGRATION_INVALID = 218;
|
|
92
|
-
export declare const WARN_SPLITS_FILTER_IGNORED = 219;
|
|
93
92
|
export declare const WARN_SPLITS_FILTER_INVALID = 220;
|
|
94
93
|
export declare const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
95
94
|
export declare const WARN_SDK_KEY = 222;
|
package/types/types.d.ts
CHANGED
|
@@ -602,10 +602,10 @@ export declare namespace SplitIO {
|
|
|
602
602
|
[treatmentName: string]: string;
|
|
603
603
|
};
|
|
604
604
|
/**
|
|
605
|
-
*
|
|
605
|
+
* List of sets of the feature flag.
|
|
606
606
|
* @property {string[]} sets
|
|
607
607
|
*/
|
|
608
|
-
sets
|
|
608
|
+
sets: string[];
|
|
609
609
|
/**
|
|
610
610
|
* The default treatment of the feature flag.
|
|
611
611
|
* @property {string} defaultTreatment
|