@splitsoftware/splitio-commons 2.2.1-rc.5 → 2.3.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 +26 -26
- package/README.md +0 -1
- package/cjs/evaluator/combiners/and.js +6 -2
- package/cjs/evaluator/combiners/ifelseif.js +6 -6
- package/cjs/evaluator/condition/index.js +5 -6
- package/cjs/evaluator/index.js +7 -7
- package/cjs/evaluator/matchers/index.js +1 -3
- package/cjs/evaluator/matchers/matcherTypes.js +0 -1
- package/cjs/evaluator/matchersTransform/index.js +0 -4
- package/cjs/evaluator/parser/index.js +2 -2
- package/cjs/evaluator/value/sanitize.js +0 -1
- package/cjs/logger/constants.js +3 -4
- package/cjs/logger/messages/debug.js +2 -3
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/services/splitApi.js +4 -3
- package/cjs/services/splitHttpClient.js +3 -2
- package/cjs/storages/AbstractSplitsCacheSync.js +2 -5
- package/cjs/storages/KeyBuilder.js +0 -9
- package/cjs/storages/KeyBuilderCS.js +0 -3
- package/cjs/storages/KeyBuilderSS.js +0 -3
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
- package/cjs/storages/inLocalStorage/index.js +1 -5
- package/cjs/storages/inLocalStorage/validateCache.js +1 -2
- package/cjs/storages/inMemory/InMemoryStorage.js +0 -3
- package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -4
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +0 -1
- package/cjs/storages/inRedis/index.js +0 -2
- package/cjs/storages/pluggable/index.js +0 -2
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +4 -54
- package/cjs/sync/polling/pollingManagerCS.js +7 -7
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +33 -59
- package/cjs/sync/streaming/SSEHandler/index.js +0 -1
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +77 -106
- package/cjs/sync/streaming/constants.js +1 -2
- package/cjs/sync/streaming/pushManager.js +16 -3
- package/cjs/sync/syncManagerOnline.js +2 -2
- package/cjs/utils/constants/index.js +2 -6
- package/esm/evaluator/combiners/and.js +6 -2
- package/esm/evaluator/combiners/ifelseif.js +7 -7
- package/esm/evaluator/condition/index.js +5 -6
- package/esm/evaluator/index.js +7 -7
- package/esm/evaluator/matchers/index.js +1 -3
- package/esm/evaluator/matchers/matcherTypes.js +0 -1
- package/esm/evaluator/matchersTransform/index.js +0 -4
- package/esm/evaluator/parser/index.js +2 -2
- package/esm/evaluator/value/sanitize.js +0 -1
- package/esm/logger/constants.js +0 -1
- package/esm/logger/messages/debug.js +2 -3
- package/esm/logger/messages/warn.js +1 -1
- package/esm/services/splitApi.js +4 -3
- package/esm/services/splitHttpClient.js +3 -2
- package/esm/storages/AbstractSplitsCacheSync.js +2 -5
- package/esm/storages/KeyBuilder.js +0 -9
- package/esm/storages/KeyBuilderCS.js +0 -3
- package/esm/storages/KeyBuilderSS.js +0 -3
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -9
- package/esm/storages/inLocalStorage/index.js +1 -5
- package/esm/storages/inLocalStorage/validateCache.js +1 -2
- package/esm/storages/inMemory/InMemoryStorage.js +0 -3
- package/esm/storages/inMemory/InMemoryStorageCS.js +0 -4
- package/esm/storages/inMemory/SplitsCacheInMemory.js +0 -1
- package/esm/storages/inRedis/index.js +0 -2
- package/esm/storages/pluggable/index.js +0 -2
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +4 -54
- package/esm/sync/polling/pollingManagerCS.js +7 -7
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +33 -59
- package/esm/sync/streaming/SSEHandler/index.js +1 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +73 -102
- package/esm/sync/streaming/constants.js +0 -1
- package/esm/sync/streaming/pushManager.js +19 -6
- package/esm/sync/syncManagerOnline.js +2 -2
- package/esm/utils/constants/index.js +1 -5
- package/package.json +1 -1
- package/src/dtos/types.ts +8 -37
- package/src/evaluator/Engine.ts +1 -1
- package/src/evaluator/combiners/and.ts +4 -5
- package/src/evaluator/combiners/ifelseif.ts +9 -7
- package/src/evaluator/condition/engineUtils.ts +1 -1
- package/src/evaluator/condition/index.ts +12 -12
- package/src/evaluator/index.ts +7 -7
- package/src/evaluator/matchers/index.ts +1 -3
- package/src/evaluator/matchers/matcherTypes.ts +0 -1
- package/src/evaluator/matchersTransform/index.ts +0 -3
- package/src/evaluator/parser/index.ts +3 -3
- package/src/evaluator/types.ts +2 -2
- package/src/evaluator/value/index.ts +2 -2
- package/src/evaluator/value/sanitize.ts +4 -5
- package/src/logger/constants.ts +0 -1
- package/src/logger/messages/debug.ts +2 -3
- package/src/logger/messages/warn.ts +1 -1
- package/src/sdkFactory/types.ts +1 -1
- package/src/sdkManager/index.ts +1 -1
- package/src/services/splitApi.ts +4 -3
- package/src/services/splitHttpClient.ts +3 -2
- package/src/services/types.ts +1 -1
- package/src/storages/AbstractSplitsCacheSync.ts +3 -6
- package/src/storages/KeyBuilder.ts +0 -12
- package/src/storages/KeyBuilderCS.ts +0 -4
- package/src/storages/KeyBuilderSS.ts +0 -4
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +14 -10
- package/src/storages/inLocalStorage/index.ts +1 -5
- package/src/storages/inLocalStorage/validateCache.ts +1 -3
- package/src/storages/inMemory/InMemoryStorage.ts +0 -3
- package/src/storages/inMemory/InMemoryStorageCS.ts +0 -4
- package/src/storages/inMemory/SplitsCacheInMemory.ts +0 -1
- package/src/storages/inRedis/index.ts +0 -2
- package/src/storages/pluggable/index.ts +0 -2
- package/src/storages/types.ts +1 -33
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +4 -65
- package/src/sync/polling/fetchers/types.ts +0 -1
- package/src/sync/polling/pollingManagerCS.ts +7 -7
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +1 -1
- package/src/sync/polling/types.ts +2 -2
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +43 -70
- package/src/sync/streaming/SSEHandler/index.ts +1 -2
- package/src/sync/streaming/SSEHandler/types.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +68 -98
- package/src/sync/streaming/constants.ts +0 -1
- package/src/sync/streaming/parseUtils.ts +2 -2
- package/src/sync/streaming/pushManager.ts +18 -6
- package/src/sync/streaming/types.ts +2 -3
- package/src/sync/syncManagerOnline.ts +2 -2
- package/src/utils/constants/index.ts +1 -6
- package/src/utils/lang/index.ts +1 -1
- package/cjs/evaluator/matchers/rbsegment.js +0 -56
- package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -117
- package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +0 -61
- package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +0 -64
- package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +0 -64
- package/esm/evaluator/matchers/rbsegment.js +0 -52
- package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -114
- package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +0 -58
- package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +0 -61
- package/esm/storages/pluggable/RBSegmentsCachePluggable.js +0 -61
- package/src/evaluator/matchers/rbsegment.ts +0 -74
- package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +0 -136
- package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +0 -68
- package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +0 -79
- package/src/storages/pluggable/RBSegmentsCachePluggable.ts +0 -76
package/CHANGES.txt
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
2.3.0 (May
|
|
2
|
-
- Added support for targeting rules based on rule-based segments.
|
|
1
|
+
2.3.0 (May 16, 2025)
|
|
3
2
|
- Updated the Redis storage to:
|
|
4
3
|
- Avoid lazy require of the `ioredis` dependency when the SDK is initialized, and
|
|
5
4
|
- Flag the SDK as ready from cache immediately to allow queueing feature flag evaluations before SDK_READY event is emitted (Reverted in v1.7.0).
|
|
5
|
+
- Bugfix - Enhanced HTTP client module to implement timeouts for failing requests that might otherwise remain pending indefinitely on some Fetch API implementations.
|
|
6
6
|
|
|
7
7
|
2.2.0 (March 28, 2025)
|
|
8
8
|
- Added a new optional argument to the client `getTreatment` methods to allow passing additional evaluation options, such as a map of properties to append to the generated impressions sent to Split backend. Read more in our docs.
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
- Added support for the new impressions tracking toggle available on feature flags, both respecting the setting and including the new field being returned on `SplitView` type objects. Read more in our docs.
|
|
16
16
|
|
|
17
17
|
2.0.3 (January 9, 2025)
|
|
18
|
-
-
|
|
18
|
+
- Bugfix - Properly handle rejected promises when using targeting rules with segment matchers in consumer modes (e.g., Redis and Pluggable storages).
|
|
19
19
|
|
|
20
20
|
2.0.2 (December 3, 2024)
|
|
21
21
|
- Updated the factory `init` and `destroy` methods to support re-initialization after destruction. This update ensures compatibility of the React SDK with React Strict Mode, where the factory's `init` and `destroy` effects are executed an extra time to validate proper resource cleanup.
|
|
22
|
-
-
|
|
22
|
+
- Bugfix - Sanitize the `SplitSDKMachineName` header value to avoid exceptions on HTTP/S requests when it contains non ISO-8859-1 characters (Related to issue https://github.com/splitio/javascript-client/issues/847).
|
|
23
23
|
|
|
24
24
|
2.0.1 (November 25, 2024)
|
|
25
|
-
-
|
|
25
|
+
- Bugfix - Fixed an issue with the SDK_UPDATE event on server-side, where it was not being emitted if there was an empty segment and the SDK received a feature flag update notification.
|
|
26
26
|
|
|
27
27
|
2.0.0 (November 1, 2024)
|
|
28
28
|
- Added support for targeting rules based on large segments.
|
|
29
29
|
- Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
|
|
30
30
|
- Added `SplitIO` namespace with the public TypeScript definitions to be reused by the SDKs.
|
|
31
31
|
- Updated the handling of timers and async operations inside an `init` factory method to enable lazy initialization of the SDK in standalone mode. This update is intended for the React SDK.
|
|
32
|
-
-
|
|
32
|
+
- Bugfix - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
|
|
33
33
|
- BREAKING CHANGES:
|
|
34
34
|
- Updated default flag spec version to 1.2, which requires Split Proxy v5.9.0 or higher.
|
|
35
35
|
- Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint.
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
1.16.0 (June 13, 2024)
|
|
49
49
|
- Added the `getOptions` method to the `IPlatform` interface to allow the SDK to pass request options to the `fetch` function and `EventSource` constructor when fetching data from the Split servers. The method is optional and, if provided, it is called twice: first for the `fetch` options and then for the `EventSource` options. Useful for advanced use cases like configuring a proxy or validating HTTPS certificates in Node.js.
|
|
50
50
|
- Updated the Redis storage to lazily import the `ioredis` dependency when the storage is created. This prevents errors when the SDK is imported or bundled in a .mjs file, as `ioredis` is a CommonJS module.
|
|
51
|
-
-
|
|
52
|
-
-
|
|
51
|
+
- Bugfix - Restored some input validation error logs that were removed in version 1.12.0. The logs inform the user when the `getTreatment(s)` methods are called with an invalid value as feature flag name or flag set name.
|
|
52
|
+
- Bugfix - Fixed localhost mode to emit SDK_UPDATE when mocked feature flags are updated in the `features` object map of the config object (Related to issue https://github.com/splitio/javascript-browser-client/issues/119).
|
|
53
53
|
|
|
54
54
|
1.15.0 (May 13, 2024)
|
|
55
55
|
- Added an optional settings validation parameter to let overwrite the default flag spec version, used by the JS Synchronizer.
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
|
|
68
68
|
1.12.1 (December 12, 2023)
|
|
69
69
|
- Updated PluggableStorage, for producer mode, and LocalStorage, for standalone mode, to clear the storage before initiating the synchronization process if it was previously synchronized with a different SDK key (i.e., a different environment) or different Split Filter criteria.
|
|
70
|
-
-
|
|
70
|
+
- Bugfix - Fixed an issue when tracking telemetry latencies for the new `getTreatmentsByFlagSet(s)` methods in Redis and Pluggable storages, which was causing the SDK to not track those stats.
|
|
71
71
|
|
|
72
72
|
1.12.0 (December 4, 2023)
|
|
73
73
|
- Added support for Flag Sets in "consumer" and "partial consumer" modes for Pluggable and Redis storages.
|
|
74
74
|
- Updated evaluation flow to log a warning when using flag sets that don't contain cached feature flags.
|
|
75
75
|
- Updated Redis adapter to handle timeouts and queueing of some missing commands: 'hincrby', 'popNRaw', and 'pipeline.exec'.
|
|
76
|
-
-
|
|
76
|
+
- Bugfix - Fixed manager methods in consumer modes to return results in a promise when the SDK is not operational (not ready or destroyed).
|
|
77
77
|
|
|
78
78
|
1.11.0 (November 3, 2023)
|
|
79
79
|
- 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):
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
- 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.
|
|
84
84
|
- 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.
|
|
85
85
|
- 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.
|
|
86
|
-
-
|
|
86
|
+
- Bugfix - Fixed SDK key validation in Node.js to ensure the SDK_READY_TIMED_OUT event is emitted when a client-side type SDK key is provided instead of a server-side one (Related to issue https://github.com/splitio/javascript-client/issues/768).
|
|
87
87
|
|
|
88
88
|
1.10.0 (October 20, 2023)
|
|
89
89
|
- 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).
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
1.8.3 (June 29, 2023)
|
|
103
103
|
- Updated some transitive dependencies for vulnerability fixes.
|
|
104
104
|
- Updated SDK_READY_TIMED_OUT event to be emitted immediately when a connection error occurs using pluggable storage (i.e., when the wrapper `connect` promise is rejected) in consumer and partial consumer modes.
|
|
105
|
-
-
|
|
105
|
+
- Bugfix - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent unexpected behaviours when `getTreatment` and `track` methods are called synchronously after `destroy` method is called.
|
|
106
106
|
|
|
107
107
|
1.8.2 (May 15, 2023)
|
|
108
108
|
- Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and IntelliSense comments.
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
1.7.3 (December 16, 2022)
|
|
119
119
|
- Updated unique keys cache for Redis and Pluggable storages to optimize the usage of the underlying storage.
|
|
120
120
|
- Updated some transitive dependencies for vulnerability fixes.
|
|
121
|
-
-
|
|
121
|
+
- Bugfix - Updated events and impressions cache in localhost mode in order to avoid memory leaks (Related to issue https://github.com/splitio/javascript-commons/issues/181).
|
|
122
122
|
|
|
123
123
|
1.7.2 (October 14, 2022)
|
|
124
|
-
-
|
|
124
|
+
- Bugfix - Handle `Navigator.sendBeacon` API exceptions in the browser, and fallback to regular Fetch/XHR transport in case of error.
|
|
125
125
|
|
|
126
126
|
1.7.1 (October 5, 2022)
|
|
127
127
|
- Updated default value of `scheduler.featuresRefreshRate` config parameter to 60 seconds.
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
- Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
|
|
140
140
|
- Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
|
|
141
141
|
- Updated the synchronization flow to be more reliable in the event of an edge case generating delay in cache purge propagation, keeping the SDK cache properly synced.
|
|
142
|
-
-
|
|
142
|
+
- Bugfix - Removed js-yaml dependency to avoid resolution to an incompatible version on certain npm versions when installing third-party dependencies that also define js-yaml as transitive dependency (Related to issue https://github.com/splitio/javascript-client/issues/662).
|
|
143
143
|
|
|
144
144
|
1.5.0 (June 29, 2022)
|
|
145
145
|
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config `sync.enabled`. Running online, Split SDK will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
|
|
@@ -147,16 +147,16 @@
|
|
|
147
147
|
- Updated submitters logic, to avoid duplicating the post of impressions to Split cloud when the SDK is destroyed while its periodic post of impressions is running.
|
|
148
148
|
|
|
149
149
|
1.4.1 (June 13, 2022)
|
|
150
|
-
-
|
|
150
|
+
- Bugfix - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending.
|
|
151
151
|
|
|
152
152
|
1.4.0 (May 24, 2022)
|
|
153
153
|
- Added `scheduler.telemetryRefreshRate` property to SDK configuration, and deprecated `scheduler.metricsRefreshRate` property.
|
|
154
154
|
- Updated SDK telemetry storage, metrics and updater to be more effective and send less often.
|
|
155
|
-
-
|
|
155
|
+
- Bugfix - Updated default values for `scheduler.impressionsRefreshRate` config parameter: 300s for OPTIMIZED impression mode and 60s for DEBUG impression mode.
|
|
156
156
|
|
|
157
157
|
1.3.1 (April 19, 2022)
|
|
158
|
-
-
|
|
159
|
-
-
|
|
158
|
+
- Bugfix - Added peer dependencies to avoid issues when requiring some third-party dependencies used by modules of the package (Related to issue https://github.com/splitio/javascript-client/issues/662).
|
|
159
|
+
- Bugfix - Updated `ready` method to rejects the promise with an Error object instead of a string value (Related to issue https://github.com/splitio/javascript-client/issues/654).
|
|
160
160
|
|
|
161
161
|
1.3.0 (April 6, 2022)
|
|
162
162
|
- Added user consent feature to allow delaying or disabling the data tracking from SDK until user consent is explicitly granted or declined. Read more in our docs.
|
|
@@ -165,12 +165,12 @@
|
|
|
165
165
|
- Updated format for MySegments keys in LocalStorage, keeping backwards compatibility (issue https://github.com/splitio/javascript-client/issues/638).
|
|
166
166
|
- Updated some modules due to general polishing and refactors, including updates in some log messages.
|
|
167
167
|
- Updated some dependencies for vulnerability fixes.
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
168
|
+
- Bugfix - Updated internal isObject utility function, to avoid unexpected behaviors on frameworks and libraries that uses multiple VM contexts, like NuxtJS dev server.
|
|
169
|
+
- Bugfix - Fixed validation of `core.key` SDK configuration param, to parse it into a string and log a warning when passing a number (Related to issue https://github.com/splitio/react-native-client/issues/19).
|
|
170
|
+
- Bugfix - Fixed validation of `sync.impressionsMode` SDK configuration param, to avoid an exception on SplitFactory instantiation when passing a non-string value.
|
|
171
|
+
- Bugfix - Fixed an issue with `connectionTimeout` options params of Redis storage, that was being ignored and not passed down to the underlying ioredis client.
|
|
172
|
+
- Bugfix - Fixed streaming synchronization issue with multiple clients.
|
|
173
|
+
- Bugfix - Fixed issue with internal Map ponyfill that results in logger not working properly on IE11 browser.
|
|
174
174
|
|
|
175
175
|
1.2.0 (January 19, 2022)
|
|
176
176
|
- Added support to SDK clients on browser to optionally bind attributes to the client, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag.
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
customers to implement this caching with any storage technology of choice and connect it to the SDK instance to be used instead of its default in-memory storage.
|
|
181
181
|
- Updated multiple modules due to general polishing and improvements, including the replacement of default exports with named exports, to avoid runtime errors with some particular configurations of Webpack projects.
|
|
182
182
|
- Updated ioredis dependency for vulnerability fixes.
|
|
183
|
-
-
|
|
183
|
+
- Bugfix - Fixed issue returning dynamic configs if treatment name contains a dot (".").
|
|
184
184
|
|
|
185
185
|
1.0.0 (October 20, 2021)
|
|
186
186
|
- BREAKING CHANGE on multiple modules due to general polishing, improvements and bug fixes. In most cases the change is to use named exports. This affected mostly modules related with synchronization and storages.
|
package/README.md
CHANGED
|
@@ -27,7 +27,6 @@ Split has built and maintains SDKs for:
|
|
|
27
27
|
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
|
|
28
28
|
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
|
|
29
29
|
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
|
|
30
|
-
* Elixir thin-client [Github](https://github.com/splitio/elixir-thin-client) [Docs](https://help.split.io/hc/en-us/articles/26988707417869-Elixir-Thin-Client-SDK)
|
|
31
30
|
* Flutter [Github](https://github.com/splitio/flutter-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin)
|
|
32
31
|
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
|
|
33
32
|
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
|
|
@@ -11,8 +11,12 @@ function andCombinerContext(log, matchers) {
|
|
|
11
11
|
log.debug(constants_1.ENGINE_COMBINER_AND, [hasMatchedAll]);
|
|
12
12
|
return hasMatchedAll;
|
|
13
13
|
}
|
|
14
|
-
return function andCombiner(
|
|
15
|
-
var
|
|
14
|
+
return function andCombiner() {
|
|
15
|
+
var params = [];
|
|
16
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
17
|
+
params[_i] = arguments[_i];
|
|
18
|
+
}
|
|
19
|
+
var matcherResults = matchers.map(function (matcher) { return matcher.apply(void 0, params); });
|
|
16
20
|
// If any matching result is a thenable we should use Promise.all
|
|
17
21
|
if ((0, lang_1.findIndex)(matcherResults, thenable_1.thenable) !== -1) {
|
|
18
22
|
return Promise.all(matcherResults).then(andResults);
|
|
@@ -14,12 +14,12 @@ function ifElseIfCombinerContext(log, predicates) {
|
|
|
14
14
|
label: labels_1.UNSUPPORTED_MATCHER_TYPE
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function computeTreatment(predicateResults) {
|
|
18
|
+
var len = predicateResults.length;
|
|
19
|
+
for (var i = 0; i < len; i++) {
|
|
19
20
|
var evaluation = predicateResults[i];
|
|
20
21
|
if (evaluation !== undefined) {
|
|
21
|
-
|
|
22
|
-
log.debug(constants_2.ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
|
|
22
|
+
log.debug(constants_2.ENGINE_COMBINER_IFELSEIF, [evaluation.treatment]);
|
|
23
23
|
return evaluation;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -33,9 +33,9 @@ function ifElseIfCombinerContext(log, predicates) {
|
|
|
33
33
|
var predicateResults = predicates.map(function (evaluator) { return evaluator(key, seed, trafficAllocation, trafficAllocationSeed, attributes, splitEvaluator); });
|
|
34
34
|
// if we find a thenable
|
|
35
35
|
if ((0, lang_1.findIndex)(predicateResults, thenable_1.thenable) !== -1) {
|
|
36
|
-
return Promise.all(predicateResults).then(function (results) { return
|
|
36
|
+
return Promise.all(predicateResults).then(function (results) { return computeTreatment(results); });
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return computeTreatment(predicateResults);
|
|
39
39
|
}
|
|
40
40
|
// if there is none predicates, then there was an error in parsing phase
|
|
41
41
|
if (!Array.isArray(predicates) || predicates.length === 0) {
|
|
@@ -7,12 +7,11 @@ var labels_1 = require("../../utils/labels");
|
|
|
7
7
|
// Build Evaluation object if and only if matchingResult is true
|
|
8
8
|
function match(log, matchingResult, bucketingKey, seed, treatments, label) {
|
|
9
9
|
if (matchingResult) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
true;
|
|
10
|
+
var treatment = (0, engineUtils_1.getTreatment)(log, bucketingKey, seed, treatments);
|
|
11
|
+
return {
|
|
12
|
+
treatment: treatment,
|
|
13
|
+
label: label
|
|
14
|
+
};
|
|
16
15
|
}
|
|
17
16
|
// else we should notify the engine to continue evaluating
|
|
18
17
|
return undefined;
|
package/cjs/evaluator/index.js
CHANGED
|
@@ -29,12 +29,12 @@ function evaluateFeature(log, key, splitName, attributes, storage) {
|
|
|
29
29
|
return treatmentException;
|
|
30
30
|
}
|
|
31
31
|
if ((0, thenable_1.thenable)(parsedSplit)) {
|
|
32
|
-
return parsedSplit.then(function (split) { return getEvaluation(log,
|
|
32
|
+
return parsedSplit.then(function (split) { return getEvaluation(log, split, key, attributes, storage); }).catch(
|
|
33
33
|
// Exception on async `getSplit` storage. For example, when the storage is redis or
|
|
34
34
|
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
35
35
|
function () { return treatmentException; });
|
|
36
36
|
}
|
|
37
|
-
return getEvaluation(log,
|
|
37
|
+
return getEvaluation(log, parsedSplit, key, attributes, storage);
|
|
38
38
|
}
|
|
39
39
|
exports.evaluateFeature = evaluateFeature;
|
|
40
40
|
function evaluateFeatures(log, key, splitNames, attributes, storage) {
|
|
@@ -47,13 +47,13 @@ function evaluateFeatures(log, key, splitNames, attributes, storage) {
|
|
|
47
47
|
return treatmentsException(splitNames);
|
|
48
48
|
}
|
|
49
49
|
return (0, thenable_1.thenable)(parsedSplits) ?
|
|
50
|
-
parsedSplits.then(function (splits) { return getEvaluations(log,
|
|
50
|
+
parsedSplits.then(function (splits) { return getEvaluations(log, splitNames, splits, key, attributes, storage); })
|
|
51
51
|
.catch(function () {
|
|
52
52
|
// Exception on async `getSplits` storage. For example, when the storage is redis or
|
|
53
53
|
// pluggable and there is a connection issue and we can't retrieve the split to be evaluated
|
|
54
54
|
return treatmentsException(splitNames);
|
|
55
55
|
}) :
|
|
56
|
-
getEvaluations(log,
|
|
56
|
+
getEvaluations(log, splitNames, parsedSplits, key, attributes, storage);
|
|
57
57
|
}
|
|
58
58
|
exports.evaluateFeatures = evaluateFeatures;
|
|
59
59
|
function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, method) {
|
|
@@ -90,7 +90,7 @@ function evaluateFeaturesByFlagSets(log, key, flagSets, attributes, storage, met
|
|
|
90
90
|
evaluate(storedFlagNames);
|
|
91
91
|
}
|
|
92
92
|
exports.evaluateFeaturesByFlagSets = evaluateFeaturesByFlagSets;
|
|
93
|
-
function getEvaluation(log,
|
|
93
|
+
function getEvaluation(log, splitJSON, key, attributes, storage) {
|
|
94
94
|
var evaluation = {
|
|
95
95
|
treatment: constants_1.CONTROL,
|
|
96
96
|
label: labels_1.SPLIT_NOT_FOUND,
|
|
@@ -116,11 +116,11 @@ function getEvaluation(log, key, splitJSON, attributes, storage) {
|
|
|
116
116
|
}
|
|
117
117
|
return evaluation;
|
|
118
118
|
}
|
|
119
|
-
function getEvaluations(log,
|
|
119
|
+
function getEvaluations(log, splitNames, splits, key, attributes, storage) {
|
|
120
120
|
var result = {};
|
|
121
121
|
var thenables = [];
|
|
122
122
|
splitNames.forEach(function (splitName) {
|
|
123
|
-
var evaluation = getEvaluation(log,
|
|
123
|
+
var evaluation = getEvaluation(log, splits[splitName], key, attributes, storage);
|
|
124
124
|
if ((0, thenable_1.thenable)(evaluation)) {
|
|
125
125
|
thenables.push(evaluation.then(function (res) {
|
|
126
126
|
result[splitName] = res;
|
|
@@ -24,7 +24,6 @@ var semver_gte_1 = require("./semver_gte");
|
|
|
24
24
|
var semver_lte_1 = require("./semver_lte");
|
|
25
25
|
var semver_between_1 = require("./semver_between");
|
|
26
26
|
var semver_inlist_1 = require("./semver_inlist");
|
|
27
|
-
var rbsegment_1 = require("./rbsegment");
|
|
28
27
|
var matchers = [
|
|
29
28
|
undefined,
|
|
30
29
|
all_1.allMatcherContext,
|
|
@@ -49,8 +48,7 @@ var matchers = [
|
|
|
49
48
|
semver_lte_1.lessThanEqualToSemverMatcherContext,
|
|
50
49
|
semver_between_1.betweenSemverMatcherContext,
|
|
51
50
|
semver_inlist_1.inListSemverMatcherContext,
|
|
52
|
-
large_segment_1.largeSegmentMatcherContext,
|
|
53
|
-
rbsegment_1.ruleBasedSegmentMatcherContext // IN_RULE_BASED_SEGMENT: 24
|
|
51
|
+
large_segment_1.largeSegmentMatcherContext, // IN_LARGE_SEGMENT: 23
|
|
54
52
|
];
|
|
55
53
|
/**
|
|
56
54
|
* Matcher factory.
|
|
@@ -81,10 +81,6 @@ function matchersTransform(matchers) {
|
|
|
81
81
|
type === matcherTypes_1.matcherTypes.LESS_THAN_OR_EQUAL_TO_SEMVER) {
|
|
82
82
|
value = stringMatcherData;
|
|
83
83
|
}
|
|
84
|
-
else if (type === matcherTypes_1.matcherTypes.IN_RULE_BASED_SEGMENT) {
|
|
85
|
-
value = (0, segment_1.segmentTransform)(userDefinedSegmentMatcherData);
|
|
86
|
-
dataType = matcherTypes_1.matcherDataTypes.NOT_SPECIFIED;
|
|
87
|
-
}
|
|
88
84
|
return {
|
|
89
85
|
attribute: attribute,
|
|
90
86
|
negate: negate,
|
|
@@ -53,9 +53,9 @@ function parser(log, conditions, storage) {
|
|
|
53
53
|
// and break the loop
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
|
-
predicates.push((0, condition_1.conditionContext)(log, (0, and_1.andCombinerContext)(log, expressions),
|
|
56
|
+
predicates.push((0, condition_1.conditionContext)(log, (0, and_1.andCombinerContext)(log, expressions), treatments_1.Treatments.parse(partitions), label, conditionType));
|
|
57
57
|
}
|
|
58
|
-
//
|
|
58
|
+
// Instanciate evaluator given the set of conditions using if else if logic
|
|
59
59
|
return (0, ifelseif_1.ifElseIfCombinerContext)(log, predicates);
|
|
60
60
|
}
|
|
61
61
|
exports.parser = parser;
|
|
@@ -52,7 +52,6 @@ function getProcessingFunction(matcherTypeID, dataType) {
|
|
|
52
52
|
case matcherTypes_1.matcherTypes.BETWEEN:
|
|
53
53
|
return dataType === 'DATETIME' ? convertions_1.zeroSinceSS : undefined;
|
|
54
54
|
case matcherTypes_1.matcherTypes.IN_SPLIT_TREATMENT:
|
|
55
|
-
case matcherTypes_1.matcherTypes.IN_RULE_BASED_SEGMENT:
|
|
56
55
|
return dependencyProcessor;
|
|
57
56
|
default:
|
|
58
57
|
return undefined;
|
package/cjs/logger/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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 = 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.ENGINE_MATCHER_RESULT = exports.SETTINGS_SPLITS_FILTER = exports.SYNC_TASK_STOP = exports.SYNC_TASK_EXECUTE = exports.SYNC_TASK_START = exports.STREAMING_NEW_MESSAGE = exports.
|
|
4
|
-
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 = 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_WITHOUT_FLAGS = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_LOWERCASE_FLAGSET = exports.WARN_INVALID_FLAGSET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MEMBERSHIPS_UPDATE = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.WARN_SPLITS_FILTER_IGNORED = 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 =
|
|
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_CLIENT_INSTANTIATION = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ENGINE_MATCHER_ERROR = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN =
|
|
3
|
+
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 = 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.ENGINE_MATCHER_RESULT = exports.SETTINGS_SPLITS_FILTER = exports.SYNC_TASK_STOP = exports.SYNC_TASK_EXECUTE = exports.SYNC_TASK_START = exports.STREAMING_NEW_MESSAGE = exports.SYNC_SPLITS_UPDATE = 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_DEPENDENCY_PRE = exports.ENGINE_MATCHER_DEPENDENCY = exports.ENGINE_BUCKET = exports.ENGINE_COMBINER_IFELSEIF_NO_TREATMENT = exports.ENGINE_COMBINER_IFELSEIF = exports.ENGINE_COMBINER_AND = void 0;
|
|
4
|
+
exports.ERROR_STORAGE_INVALID = 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 = 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_WITHOUT_FLAGS = exports.WARN_FLAGSET_NOT_CONFIGURED = exports.WARN_LOWERCASE_FLAGSET = exports.WARN_INVALID_FLAGSET = exports.STREAMING_PARSING_SPLIT_UPDATE = exports.STREAMING_PARSING_MEMBERSHIPS_UPDATE = exports.WARN_SDK_KEY = exports.WARN_SPLITS_FILTER_EMPTY = exports.WARN_SPLITS_FILTER_INVALID = exports.WARN_SPLITS_FILTER_IGNORED = 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 = 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_CLIENT_INSTANTIATION = exports.LOG_PREFIX_INSTANTIATION = exports.LOG_PREFIX_SETTINGS = exports.ENGINE_MATCHER_ERROR = exports.ERROR_SETS_FILTER_EXCLUSIVE = exports.ERROR_TOO_MANY_SETS = exports.ERROR_MIN_CONFIG_PARAM = exports.ERROR_NOT_BOOLEAN = 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.
|
|
@@ -26,7 +26,6 @@ exports.RETRIEVE_MANAGER = 29;
|
|
|
26
26
|
exports.SYNC_OFFLINE_DATA = 30;
|
|
27
27
|
exports.SYNC_SPLITS_FETCH = 31;
|
|
28
28
|
exports.SYNC_SPLITS_UPDATE = 32;
|
|
29
|
-
exports.SYNC_RBS_UPDATE = 33;
|
|
30
29
|
exports.STREAMING_NEW_MESSAGE = 35;
|
|
31
30
|
exports.SYNC_TASK_START = 36;
|
|
32
31
|
exports.SYNC_TASK_EXECUTE = 37;
|
|
@@ -23,9 +23,8 @@ exports.codesDebug = info_1.codesInfo.concat([
|
|
|
23
23
|
[c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
|
|
24
24
|
// synchronizer
|
|
25
25
|
[c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
|
|
26
|
-
[c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s
|
|
27
|
-
[c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s.'],
|
|
28
|
-
[c.SYNC_RBS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New rule-based segments %s. Removed rule-based segments %s.'],
|
|
26
|
+
[c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
|
|
27
|
+
[c.SYNC_SPLITS_UPDATE, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s. Removed feature flags %s. Segment names collected %s'],
|
|
29
28
|
[c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
|
|
30
29
|
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
|
|
31
30
|
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
|
|
@@ -35,7 +35,7 @@ exports.codesWarn = error_1.codesError.concat([
|
|
|
35
35
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
36
36
|
[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'],
|
|
37
37
|
[c.STREAMING_PARSING_MEMBERSHIPS_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching Memberships due to an error processing %s notification: %s'],
|
|
38
|
-
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing
|
|
38
|
+
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
|
|
39
39
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
40
40
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|
|
41
41
|
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in the Split user interface.'],
|
package/cjs/services/splitApi.js
CHANGED
|
@@ -20,6 +20,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
20
20
|
var urls = settings.urls;
|
|
21
21
|
var filterQueryString = settings.sync.__splitFiltersValidation && settings.sync.__splitFiltersValidation.queryString;
|
|
22
22
|
var SplitSDKImpressionsMode = settings.sync.impressionsMode;
|
|
23
|
+
var flagSpecVersion = settings.sync.flagSpecVersion;
|
|
23
24
|
var splitHttpClient = (0, splitHttpClient_1.splitHttpClientFactory)(settings, platform);
|
|
24
25
|
return {
|
|
25
26
|
// @TODO throw errors if health check requests fail, to log them in the Synchronizer
|
|
@@ -32,7 +33,7 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
32
33
|
return splitHttpClient(url).then(function () { return true; }).catch(function () { return false; });
|
|
33
34
|
},
|
|
34
35
|
fetchAuth: function (userMatchingKeys) {
|
|
35
|
-
var url = urls.auth + "/v2/auth?s=" +
|
|
36
|
+
var url = urls.auth + "/v2/auth?s=" + flagSpecVersion;
|
|
36
37
|
if (userMatchingKeys) { // `userMatchingKeys` is undefined in server-side
|
|
37
38
|
var queryParams = userMatchingKeys.map(userKeyToQueryParam).join('&');
|
|
38
39
|
if (queryParams)
|
|
@@ -40,8 +41,8 @@ function splitApiFactory(settings, platform, telemetryTracker) {
|
|
|
40
41
|
}
|
|
41
42
|
return splitHttpClient(url, undefined, telemetryTracker.trackHttp(constants_1.TOKEN));
|
|
42
43
|
},
|
|
43
|
-
fetchSplitChanges: function (since, noCache, till
|
|
44
|
-
var url = urls.sdk + "/splitChanges?s=" +
|
|
44
|
+
fetchSplitChanges: function (since, noCache, till) {
|
|
45
|
+
var url = urls.sdk + "/splitChanges?s=" + flagSpecVersion + "&since=" + since + (filterQueryString || '') + (till ? '&till=' + till : '');
|
|
45
46
|
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(constants_1.SPLITS))
|
|
46
47
|
.catch(function (err) {
|
|
47
48
|
if (err.statusCode === 414)
|
|
@@ -5,6 +5,7 @@ var objectAssign_1 = require("../utils/lang/objectAssign");
|
|
|
5
5
|
var constants_1 = require("../logger/constants");
|
|
6
6
|
var decorateHeaders_1 = require("./decorateHeaders");
|
|
7
7
|
var timeout_1 = require("../utils/promise/timeout");
|
|
8
|
+
var PENDING_FETCH_ERROR_TIMEOUT = 100;
|
|
8
9
|
var messageNoFetch = 'Global fetch API is not available.';
|
|
9
10
|
/**
|
|
10
11
|
* Factory of Split HTTP clients, which are HTTP clients with predefined headers for Split endpoints.
|
|
@@ -44,8 +45,8 @@ function splitHttpClientFactory(settings, _a) {
|
|
|
44
45
|
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Checking_that_the_fetch_was_successful
|
|
45
46
|
.then(function (response) {
|
|
46
47
|
if (!response.ok) {
|
|
47
|
-
//
|
|
48
|
-
return (0, timeout_1.timeout)(
|
|
48
|
+
// `text()` promise might not settle in some fetch implementations and cases (e.g. no content)
|
|
49
|
+
return (0, timeout_1.timeout)(PENDING_FETCH_ERROR_TIMEOUT, response.text()).then(function (message) { return Promise.reject({ response: response, message: message }); }, function () { return Promise.reject({ response: response }); });
|
|
49
50
|
}
|
|
50
51
|
latencyTracker();
|
|
51
52
|
return response;
|
|
@@ -53,8 +53,8 @@ exports.AbstractSplitsCacheSync = AbstractSplitsCacheSync;
|
|
|
53
53
|
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
54
54
|
* This util is intended to simplify the implementation of `splitsCache::usesSegments` method
|
|
55
55
|
*/
|
|
56
|
-
function usesSegments(
|
|
57
|
-
var conditions =
|
|
56
|
+
function usesSegments(split) {
|
|
57
|
+
var conditions = split.conditions || [];
|
|
58
58
|
for (var i = 0; i < conditions.length; i++) {
|
|
59
59
|
var matchers = conditions[i].matcherGroup.matchers;
|
|
60
60
|
for (var j = 0; j < matchers.length; j++) {
|
|
@@ -63,9 +63,6 @@ function usesSegments(ruleEntity) {
|
|
|
63
63
|
return true;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var excluded = ruleEntity.excluded;
|
|
67
|
-
if (excluded && excluded.segments && excluded.segments.length > 0)
|
|
68
|
-
return true;
|
|
69
66
|
return false;
|
|
70
67
|
}
|
|
71
68
|
exports.usesSegments = usesSegments;
|
|
@@ -28,15 +28,6 @@ var KeyBuilder = /** @class */ (function () {
|
|
|
28
28
|
KeyBuilder.prototype.buildSplitKeyPrefix = function () {
|
|
29
29
|
return this.prefix + ".split.";
|
|
30
30
|
};
|
|
31
|
-
KeyBuilder.prototype.buildRBSegmentKey = function (rbsegmentName) {
|
|
32
|
-
return this.prefix + ".rbsegment." + rbsegmentName;
|
|
33
|
-
};
|
|
34
|
-
KeyBuilder.prototype.buildRBSegmentsTillKey = function () {
|
|
35
|
-
return this.prefix + ".rbsegments.till";
|
|
36
|
-
};
|
|
37
|
-
KeyBuilder.prototype.buildRBSegmentKeyPrefix = function () {
|
|
38
|
-
return this.prefix + ".rbsegment.";
|
|
39
|
-
};
|
|
40
31
|
KeyBuilder.prototype.buildSegmentNameKey = function (segmentName) {
|
|
41
32
|
return this.prefix + ".segment." + segmentName;
|
|
42
33
|
};
|
|
@@ -35,9 +35,6 @@ var KeyBuilderCS = /** @class */ (function (_super) {
|
|
|
35
35
|
KeyBuilderCS.prototype.isSplitKey = function (key) {
|
|
36
36
|
return (0, lang_1.startsWith)(key, this.prefix + ".split.");
|
|
37
37
|
};
|
|
38
|
-
KeyBuilderCS.prototype.isRBSegmentKey = function (key) {
|
|
39
|
-
return (0, lang_1.startsWith)(key, this.prefix + ".rbsegment.");
|
|
40
|
-
};
|
|
41
38
|
KeyBuilderCS.prototype.buildSplitsWithSegmentCountKey = function () {
|
|
42
39
|
return this.prefix + ".splits.usingSegments";
|
|
43
40
|
};
|
|
@@ -42,9 +42,6 @@ var KeyBuilderSS = /** @class */ (function (_super) {
|
|
|
42
42
|
KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
|
|
43
43
|
return this.buildSplitKeyPrefix() + "*";
|
|
44
44
|
};
|
|
45
|
-
KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
|
|
46
|
-
return this.buildRBSegmentKeyPrefix() + "*";
|
|
47
|
-
};
|
|
48
45
|
/* Telemetry keys */
|
|
49
46
|
KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
|
|
50
47
|
return this.latencyPrefix + "::" + this.versionablePrefix + "/" + exports.METHOD_NAMES[method] + "/" + bucket;
|
|
@@ -41,13 +41,15 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
41
41
|
};
|
|
42
42
|
SplitsCacheInLocal.prototype._incrementCounts = function (split) {
|
|
43
43
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
localStorage.setItem(ttKey, (0, lang_1.toNumber)(localStorage.getItem(ttKey)) + 1);
|
|
47
|
-
if ((0, AbstractSplitsCacheSync_1.usesSegments)(split)) {
|
|
48
|
-
var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
|
|
44
|
+
if (split) {
|
|
45
|
+
var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
|
|
49
46
|
// @ts-expect-error
|
|
50
|
-
localStorage.setItem(
|
|
47
|
+
localStorage.setItem(ttKey, (0, lang_1.toNumber)(localStorage.getItem(ttKey)) + 1);
|
|
48
|
+
if ((0, AbstractSplitsCacheSync_1.usesSegments)(split)) {
|
|
49
|
+
var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
|
|
50
|
+
// @ts-expect-error
|
|
51
|
+
localStorage.setItem(segmentsCountKey, (0, lang_1.toNumber)(localStorage.getItem(segmentsCountKey)) + 1);
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
catch (e) {
|
|
@@ -156,9 +158,12 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
156
158
|
return true;
|
|
157
159
|
var storedCount = localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey());
|
|
158
160
|
var splitsWithSegmentsCount = storedCount === null ? 0 : (0, lang_1.toNumber)(storedCount);
|
|
159
|
-
|
|
160
|
-
splitsWithSegmentsCount > 0
|
|
161
|
-
|
|
161
|
+
if ((0, lang_1.isFiniteNumber)(splitsWithSegmentsCount)) {
|
|
162
|
+
return splitsWithSegmentsCount > 0;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
162
167
|
};
|
|
163
168
|
SplitsCacheInLocal.prototype.getNamesByFlagSets = function (flagSets) {
|
|
164
169
|
var _this = this;
|
|
@@ -8,7 +8,6 @@ var KeyBuilder_1 = require("../KeyBuilder");
|
|
|
8
8
|
var KeyBuilderCS_1 = require("../KeyBuilderCS");
|
|
9
9
|
var isLocalStorageAvailable_1 = require("../../utils/env/isLocalStorageAvailable");
|
|
10
10
|
var SplitsCacheInLocal_1 = require("./SplitsCacheInLocal");
|
|
11
|
-
var RBSegmentsCacheInLocal_1 = require("./RBSegmentsCacheInLocal");
|
|
12
11
|
var MySegmentsCacheInLocal_1 = require("./MySegmentsCacheInLocal");
|
|
13
12
|
var InMemoryStorageCS_1 = require("../inMemory/InMemoryStorageCS");
|
|
14
13
|
var constants_1 = require("./constants");
|
|
@@ -33,12 +32,10 @@ function InLocalStorage(options) {
|
|
|
33
32
|
var matchingKey = (0, key_1.getMatching)(settings.core.key);
|
|
34
33
|
var keys = new KeyBuilderCS_1.KeyBuilderCS(prefix, matchingKey);
|
|
35
34
|
var splits = new SplitsCacheInLocal_1.SplitsCacheInLocal(settings, keys);
|
|
36
|
-
var rbSegments = new RBSegmentsCacheInLocal_1.RBSegmentsCacheInLocal(settings, keys);
|
|
37
35
|
var segments = new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, keys);
|
|
38
36
|
var largeSegments = new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, (0, KeyBuilderCS_1.myLargeSegmentsKeyBuilder)(prefix, matchingKey));
|
|
39
37
|
return {
|
|
40
38
|
splits: splits,
|
|
41
|
-
rbSegments: rbSegments,
|
|
42
39
|
segments: segments,
|
|
43
40
|
largeSegments: largeSegments,
|
|
44
41
|
impressions: new ImpressionsCacheInMemory_1.ImpressionsCacheInMemory(impressionsQueueSize),
|
|
@@ -47,14 +44,13 @@ function InLocalStorage(options) {
|
|
|
47
44
|
telemetry: (0, TelemetryCacheInMemory_1.shouldRecordTelemetry)(params) ? new TelemetryCacheInMemory_1.TelemetryCacheInMemory(splits, segments) : undefined,
|
|
48
45
|
uniqueKeys: new UniqueKeysCacheInMemoryCS_1.UniqueKeysCacheInMemoryCS(),
|
|
49
46
|
validateCache: function () {
|
|
50
|
-
return (0, validateCache_1.validateCache)(options, settings, keys, splits,
|
|
47
|
+
return (0, validateCache_1.validateCache)(options, settings, keys, splits, segments, largeSegments);
|
|
51
48
|
},
|
|
52
49
|
destroy: function () { },
|
|
53
50
|
// When using shared instantiation with MEMORY we reuse everything but segments (they are customer per key).
|
|
54
51
|
shared: function (matchingKey) {
|
|
55
52
|
return {
|
|
56
53
|
splits: this.splits,
|
|
57
|
-
rbSegments: this.rbSegments,
|
|
58
54
|
segments: new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, new KeyBuilderCS_1.KeyBuilderCS(prefix, matchingKey)),
|
|
59
55
|
largeSegments: new MySegmentsCacheInLocal_1.MySegmentsCacheInLocal(log, (0, KeyBuilderCS_1.myLargeSegmentsKeyBuilder)(prefix, matchingKey)),
|
|
60
56
|
impressions: this.impressions,
|
|
@@ -57,12 +57,11 @@ function validateExpiration(options, settings, keys, currentTimestamp, isThereCa
|
|
|
57
57
|
*
|
|
58
58
|
* @returns `true` if cache is ready to be used, `false` otherwise (cache was cleared or there is no cache)
|
|
59
59
|
*/
|
|
60
|
-
function validateCache(options, settings, keys, splits,
|
|
60
|
+
function validateCache(options, settings, keys, splits, segments, largeSegments) {
|
|
61
61
|
var currentTimestamp = Date.now();
|
|
62
62
|
var isThereCache = splits.getChangeNumber() > -1;
|
|
63
63
|
if (validateExpiration(options, settings, keys, currentTimestamp, isThereCache)) {
|
|
64
64
|
splits.clear();
|
|
65
|
-
rbSegments.clear();
|
|
66
65
|
segments.clear();
|
|
67
66
|
largeSegments.clear();
|
|
68
67
|
// Update last clear timestamp
|