Skip to content

Commit

Permalink
Merge pull request #218 from splitio/development
Browse files Browse the repository at this point in the history
Release 1.8.2
  • Loading branch information
EmilianoSanchez authored May 15, 2023
2 parents a5de503 + cfd05b3 commit 85f1ed0
Show file tree
Hide file tree
Showing 47 changed files with 425 additions and 451 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"@typescript-eslint/no-unused-vars": "error",
"keyword-spacing": "error",
"comma-style": "error",
"no-trailing-spaces": "error"
"no-trailing-spaces": "error",
"space-before-function-paren": ["error", {"named": "never"}]
},

"overrides": [
Expand Down
45 changes: 25 additions & 20 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
1.8.2 (May 15, 2023)
- 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.
- Updated split storage modules to optimize some operations when using Redis and pluggable storages.
- Updated some transitive dependencies for vulnerability fixes.

1.8.1 (February 7, 2023)
- Updated a module import to remove a trailing comma that can cause issues with some bundlers.
- Updated a module import to remove a trailing comma that can cause issues with some bundlers.

1.8.0 (February 3, 2023)
- Added flush data method to client
- Added flush data method to client.

1.7.3 (December 16, 2022)
- Updated unique keys cache for Redis and Pluggable storages to optimize the usage of the underlying storage.
- Updated some transitive dependencies for vulnerability fixes.
- Bugfixing - 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).
- Updated unique keys cache for Redis and Pluggable storages to optimize the usage of the underlying storage.
- Updated some transitive dependencies for vulnerability fixes.
- Bugfixing - 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).

1.7.2 (October 14, 2022)
- Bugfixing - Handle `Navigator.sendBeacon` API exceptions in the browser, and fallback to regular Fetch/XHR transport in case of error.
- Bugfixing - Handle `Navigator.sendBeacon` API exceptions in the browser, and fallback to regular Fetch/XHR transport in case of error.

1.7.1 (October 5, 2022)
- Updated default value of `scheduler.featuresRefreshRate` config parameter to 60 seconds.
- Updated default value of `scheduler.featuresRefreshRate` config parameter to 60 seconds.

1.7.0 (October 4, 2022)
- Added a new impressions mode for the SDK called NONE, to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
- Updated SDK telemetry to support pluggable storage, partial consumer mode, and synchronizer.
- Updated storage implementations to improve the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory.
- Updated evaluation flow to avoid unnecessarily storage calls when the SDK is not ready.
- Added a new impressions mode for the SDK called NONE, to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
- Updated SDK telemetry to support pluggable storage, partial consumer mode, and synchronizer.
- Updated storage implementations to improve the performance of feature flag evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory.
- Updated evaluation flow to avoid unnecessarily storage calls when the SDK is not ready.

1.6.1 (July 22, 2022)
- Updated GoogleAnalyticsToSplit integration to validate `autoRequire` config parameter and avoid some wrong warning logs when mapping GA hit fields to Split event properties.
- Updated GoogleAnalyticsToSplit integration to validate `autoRequire` config parameter and avoid some wrong warning logs when mapping GA hit fields to Split event properties.

1.6.0 (July 21, 2022)
- 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).
- 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.
- 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.
- Bugfixing - 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).
- 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).
- 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.
- 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.
- Bugfixing - 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).

1.5.0 (June 29, 2022)
- 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 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.
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
- 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.
- 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.
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
- 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.

1.4.1 (June 13, 2022)
- Bugfixing - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending.
Expand Down Expand Up @@ -81,7 +86,7 @@
- Updated dependencies for vulnerability fixes.

0.1.0 (March 30, 2021)
- Initial public release. It includes common modules to be consumed by the different Split implementations written in JavaScript. Based on the original JS SDK in the `javascript-client` repository.
- Initial public release. It includes common modules to be consumed by the different Split SDK implementations written in JavaScript. Based on the original JS SDK in the `javascript-client` repository.
- It's designed with a modular approach, with the following goals in mind:
- Dependents should be able to include the modules that are needed for, as an example, a storage.
- Dependents should be able to use the module that's specific for their runtime environment, allowing for better usage of native APIs as well as to build optimizations targeted by each platform.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-commons.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-commons) [![Build Status](https://github.com/splitio/javascript-commons/actions/workflows/ci.yml/badge.svg)](https://github.com/splitio/javascript-commons/actions/workflows/ci.yml)

## Overview
This library is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.
This library is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.

[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-commons",
"version": "1.8.1",
"version": "1.8.2",
"description": "Split Javascript SDK common components",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/integrations/ga/__tests__/GaToSplit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ test('defaultMapper', () => {
});

const coreSettings = {
authorizationKey: 'apikey',
authorizationKey: 'sdkkey',
key: 'key',
trafficType: 'user',
} as ISettings['core'];
Expand Down
4 changes: 2 additions & 2 deletions src/integrations/ga/__tests__/gaMock.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export function modelMock(fieldsObject: UniversalAnalytics.FieldsObject) {
return {
get (fieldName: string) {
get(fieldName: string) {
return fieldsObject[fieldName as keyof UniversalAnalytics.FieldsObject];
},
set (fieldNameOrObject: string | {}, fieldValue?: any) {
set(fieldNameOrObject: string | {}, fieldValue?: any) {
if (typeof fieldNameOrObject === 'object')
fieldsObject = { ...fieldsObject, ...fieldNameOrObject };
else
Expand Down
4 changes: 2 additions & 2 deletions src/logger/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const WARN_INTEGRATION_INVALID = 218;
export const WARN_SPLITS_FILTER_IGNORED = 219;
export const WARN_SPLITS_FILTER_INVALID = 220;
export const WARN_SPLITS_FILTER_EMPTY = 221;
export const WARN_API_KEY = 222;
export const WARN_SDK_KEY = 222;
export const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;

export const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
Expand Down Expand Up @@ -136,7 +136,7 @@ export const LOG_PREFIX_SYNC = 'sync';
export const LOG_PREFIX_SYNC_MANAGER = LOG_PREFIX_SYNC + ':sync-manager: ';
export const LOG_PREFIX_SYNC_OFFLINE = LOG_PREFIX_SYNC + ':offline: ';
export const LOG_PREFIX_SYNC_STREAMING = LOG_PREFIX_SYNC + ':streaming: ';
export const LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':split-changes: ';
export const LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':featureflag-changes: ';
export const LOG_PREFIX_SYNC_SEGMENTS = LOG_PREFIX_SYNC + ':segment-changes: ';
export const LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
export const LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
Expand Down
14 changes: 7 additions & 7 deletions src/logger/messages/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const codesDebug: [number, string][] = codesInfo.concat([
[c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
[c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
[c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
[c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] parent split "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent split: "%s" with key: %s %s'],
[c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],
[c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
[c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
[c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
[c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
Expand All @@ -35,15 +35,15 @@ export const codesDebug: [number, string][] = codesInfo.concat([
[c.RETRIEVE_CLIENT_EXISTING, 'Retrieving existing SDK client.'],
[c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
// synchronizer
[c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Splits data: \n%s'],
[c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up split update using since = %s'],
[c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New splits %s'],
[c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed splits %s'],
[c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
[c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
[c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s'],
[c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed feature flags %s'],
[c.SYNC_SPLITS_SEGMENTS, c.LOG_PREFIX_SYNC_SPLITS + 'Segment names collected %s'],
[c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
[c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
[c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
[c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + ': Stopping %s'],
// initialization / settings validation
[c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': splits filtering criteria is "%s".']
[c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
]);
4 changes: 2 additions & 2 deletions src/logger/messages/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import * as c from '../constants';

export const codesError: [number, string][] = [
// evaluator
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid Split, no valid rules found'],
[c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules found'],
// SDK
[c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
[c.ERROR_CLIENT_CANNOT_GET_READY, 'The SDK will not get ready. Reason: %s'],
[c.ERROR_IMPRESSIONS_TRACKER, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Could not store impressions bulk with %s impression(s). Error: %s'],
[c.ERROR_IMPRESSIONS_LISTENER, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Impression listener logImpression method threw: %s.'],
[c.ERROR_EVENTS_TRACKER, c.LOG_PREFIX_EVENTS_TRACKER + 'Failed to queue %s'],
// synchronizer
[c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock Splits data, no changes will be applied to the current cache. %s'],
[c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s'],
[c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
[c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
[c.ERROR_HTTP, 'Response status is not OK. Status: %s. URL: %s. Message: %s'],
Expand Down
6 changes: 3 additions & 3 deletions src/logger/messages/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const codesInfo: [number, string][] = codesWarn.concat([
[c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
[c.CLIENT_READY, READY_MSG],
// SDK
[c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Split: %s. Key: %s. Evaluation: %s. Label: %s'],
[c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Queueing corresponding impression.'],
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
[c.NEW_FACTORY, 'New Split SDK instance created.'],
Expand All @@ -22,13 +22,13 @@ export const codesInfo: [number, string][] = codesWarn.concat([
[c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
[c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
[c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
[c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of splits #%s. Reason: %s'],
[c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of feature flags #%s. Reason: %s'],
[c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and reseting timer.'],
[c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
[c.STREAMING_REFRESH_TOKEN, c.LOG_PREFIX_SYNC_STREAMING + 'Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.'],
[c.STREAMING_RECONNECT, c.LOG_PREFIX_SYNC_STREAMING + 'Attempting to reconnect streaming in %s seconds.'],
[c.STREAMING_CONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Connecting streaming.'],
[c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given Api key. Switching to polling mode.'],
[c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given SDK key. Switching to polling mode.'],
[c.STREAMING_DISCONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Disconnecting streaming.'],
[c.SYNC_START_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming not available. Starting polling.'],
[c.SYNC_CONTINUE_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming couldn\'t connect. Continue polling.'],
Expand Down
Loading

0 comments on commit 85f1ed0

Please sign in to comment.