From 7e870df070d20864ac761fac6b4d91385dfc89bd Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 10 May 2023 12:00:27 -0300 Subject: [PATCH 1/5] replace 'split', 'api key' and 'web console' terms --- CHANGES.txt | 4 +- README.md | 6 +- .../consumer/browser_consumer.spec.js | 2 +- .../consumer/browser_consumer_partial.spec.js | 2 +- ts-tests/index.ts | 2 +- types/splitio.d.ts | 186 +++++++++--------- 6 files changed, 102 insertions(+), 100 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 24150b8..b40e75c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,7 +16,7 @@ 0.9.0 (October 5, 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 default value of `scheduler.featuresRefreshRate` config parameter from 30 seconds to 60 seconds. - - Updated @splitsoftware/splitio-commons package to version 1.7.1, that improves the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements. + - Updated @splitsoftware/splitio-commons package to version 1.7.1, that improves the performance of feature flag evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory, among other improvements. 0.8.0 (July 22, 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). @@ -25,7 +25,7 @@ - Updated some dependencies for vulnerability fixes. 0.7.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. + - 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. - Bugfixing - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending. diff --git a/README.md b/README.md index 3058b34..3d8339c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-browserjs.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-browserjs) [![Build Status](https://github.com/splitio/javascript-browser-client/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/splitio/javascript-browser-client/actions/workflows/ci-cd.yml) ## Overview -This SDK 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 SDK 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) @@ -21,7 +21,7 @@ import { SplitFactory } from '@splitsoftware/splitio-browserjs'; // Instantiate the SDK var factory = SplitFactory({ core: { - authorizationKey: 'YOUR_SDK_API_KEY', + authorizationKey: 'YOUR_SDK_KEY', key: 'CUSTOMER_ID' } }); @@ -31,7 +31,7 @@ var client = factory.client(); // Set a callback to listen for the SDK_READY event, to make sure the SDK is properly loaded before asking for a treatment client.on(client.Event.SDK_READY, function() { - var treatment = client.getTreatment('SPLIT_NAME'); + var treatment = client.getTreatment('FEATURE_FLAG_NAME'); if (treatment == 'on') { // insert code here for on treatment } else if (treatment == 'off') { diff --git a/src/__tests__/consumer/browser_consumer.spec.js b/src/__tests__/consumer/browser_consumer.spec.js index 1144853..31fcf55 100644 --- a/src/__tests__/consumer/browser_consumer.spec.js +++ b/src/__tests__/consumer/browser_consumer.spec.js @@ -22,7 +22,7 @@ const timeFrame = Date.now(); /** @type SplitIO.IBrowserAsyncSettings */ const config = { core: { - authorizationKey: 'SOME API KEY', // in consumer mode, api key is only used to identify the sdk instance + authorizationKey: 'SOME SDK KEY', // in consumer mode, SDK key is only used to identify the sdk instance key: 'UT_Segment_member' }, mode: 'consumer', diff --git a/src/__tests__/consumer/browser_consumer_partial.spec.js b/src/__tests__/consumer/browser_consumer_partial.spec.js index 5c705ab..83a5b61 100644 --- a/src/__tests__/consumer/browser_consumer_partial.spec.js +++ b/src/__tests__/consumer/browser_consumer_partial.spec.js @@ -20,7 +20,7 @@ const TOTAL_EVENTS = 5; /** @type SplitIO.IBrowserAsyncSettings */ const config = { core: { - authorizationKey: 'SOME API KEY', // in consumer mode, api key is only used to identify the sdk instance + authorizationKey: 'SOME SDK KEY', // in consumer mode, SDK key is only used to identify the sdk instance key: 'UT_Segment_member' }, mode: 'consumer_partial', diff --git a/ts-tests/index.ts b/ts-tests/index.ts index facca4d..e7c32b1 100644 --- a/ts-tests/index.ts +++ b/ts-tests/index.ts @@ -174,7 +174,7 @@ browserSettings = { // For browser with async storage browserAsyncSettings = { core: { - authorizationKey: 'api-key', + authorizationKey: 'sdk-key', key: 'customer-key' }, mode: 'consumer', diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 6482370..469c7e1 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -202,25 +202,24 @@ interface ISharedSettings { */ sync?: { /** - * List of Split filters. These filters are used to fetch a subset of the Splits definitions in your environment, in order to reduce the delay of the SDK to be ready. + * List of feature flag filters. These filters are used to fetch a subset of the feature flag definitions in your environment, in order to reduce the delay of the SDK to be ready. * This configuration is only meaningful when the SDK is working in "standalone" mode. * - * At the moment, two types of split filters are supported: by name and by prefix. + * At the moment, only one type of feature flag filter is supported: by name. * * Example: * `splitFilter: [ - * { type: 'byName', values: ['my_split_1', 'my_split_2'] }, // will fetch splits named 'my_split_1' and 'my_split_2' - * { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix + * { type: 'byName', values: ['my_feature_flag_1', 'my_feature_flag_2'] }, // will fetch feature flags named 'my_feature_flag_1' and 'my_feature_flag_2' * ]` * @property {SplitIO.SplitFilter[]} splitFilters */ splitFilters?: SplitIO.SplitFilter[] /** - * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers. + * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers. * Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'. * - DEBUG: will send all the impressions generated (recommended only for debugging purposes). - * - OPTIMIZED: will send unique impressions to Split Servers, avoiding a considerable amount of traffic that duplicated impressions could generate. - * - NONE: will send unique keys evaluated per feature to Split Servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate. + * - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate. + * - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate. * * @property {String} impressionsMode * @default 'OPTIMIZED' @@ -269,7 +268,7 @@ interface IStatusInterface extends IEventEmitter { */ Event: EventConsts, /** - * Returns a promise that will be resolved once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted). + * Returns a promise that resolves once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted). * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the * SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready. * @@ -303,7 +302,7 @@ interface IBasicClient extends IStatusInterface { * In 'consumer' and 'partial consumer' modes, this method also disconnects the SDK from the Pluggable storage. * * @function destroy - * @returns {Promise} A promise that will be resolved once the client is destroyed. + * @returns {Promise} A promise that resolves once the client is destroyed. */ destroy(): Promise } @@ -336,17 +335,17 @@ interface IBasicSDK { */ declare namespace SplitIO { /** - * Split treatment value, returned by getTreatment. + * Feature flag treatment value, returned by getTreatment. * @typedef {string} Treatment */ type Treatment = string; /** - * Split treatment promise that will resolve to actual treatment value. + * Feature flag treatment promise that resolves to actual treatment value. * @typedef {Promise} AsyncTreatment */ type AsyncTreatment = Promise; /** - * An object with the treatments for a bulk of splits, returned by getTreatments. For example: + * An object with the treatments for a bulk of feature flags, returned by getTreatments. For example: * { * feature1: 'on', * feature2: 'off @@ -357,12 +356,12 @@ declare namespace SplitIO { [featureName: string]: Treatment }; /** - * Split treatments promise that will resolve to the actual SplitIO.Treatments object. + * Feature flags treatments promise that resolves to the actual SplitIO.Treatments object. * @typedef {Promise} AsyncTreatments */ type AsyncTreatments = Promise; /** - * Split evaluation result with treatment and configuration, returned by getTreatmentWithConfig. + * Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig. * @typedef {Object} TreatmentWithConfig * @property {string} treatment The treatment result * @property {string | null} config The stringified version of the JSON config defined for that treatment, null if there is no config for the resulting treatment. @@ -372,13 +371,13 @@ declare namespace SplitIO { config: string | null }; /** - * Split treatment promise that will resolve to actual treatment with config value. + * Feature flag treatment promise that resolves to actual treatment with config value. * @typedef {Promise} AsyncTreatmentWithConfig */ type AsyncTreatmentWithConfig = Promise; /** - * An object with the treatments with configs for a bulk of splits, returned by getTreatmentsWithConfig. - * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example: + * An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig. + * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example: * { * feature1: { treatment: 'on', config: null } * feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' } @@ -389,7 +388,7 @@ declare namespace SplitIO { [featureName: string]: TreatmentWithConfig }; /** - * Split treatments promise that will resolve to the actual SplitIO.TreatmentsWithConfig object. + * Feature flags treatments promise that resolves to the actual SplitIO.TreatmentsWithConfig object. * @typedef {Promise} AsyncTreatmentsWithConfig */ type AsyncTreatmentsWithConfig = Promise; @@ -399,7 +398,7 @@ declare namespace SplitIO { */ type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update'; /** - * Split attributes should be on object with values of type string or number (dates should be sent as millis since epoch). + * Attributes should be on object with values of type string or number (dates should be sent as millis since epoch). * @typedef {Object.} Attributes * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#attribute-syntax} */ @@ -412,7 +411,7 @@ declare namespace SplitIO { */ type AttributeType = string | number | boolean | Array; /** - * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb. + * Properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb. * @typedef {Object.} Attributes * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#track */ @@ -463,38 +462,38 @@ declare namespace SplitIO { sdkLanguageVersion: string }; /** - * Data corresponding to one Split view. + * Data corresponding to one feature flag view. * @typedef {Object} SplitView */ type SplitView = { /** - * The name of the split. + * The name of the feature flag. * @property {string} name */ name: string, /** - * The traffic type of the split. + * The traffic type of the feature flag. * @property {string} trafficType */ trafficType: string, /** - * Whether the split is killed or not. + * Whether the feature flag is killed or not. * @property {boolean} killed */ killed: boolean, /** - * The list of treatments available for the split. + * The list of treatments available for the feature flag. * @property {Array} treatments */ treatments: Array, /** - * Current change number of the split. + * Current change number of the feature flag. * @property {number} changeNumber */ changeNumber: number, /** * Map of configurations per treatment. - * Each existing configuration is a stringified version of the JSON you defined on the Split web console. + * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. * @property {Object.} configs */ configs: { @@ -502,7 +501,7 @@ declare namespace SplitIO { } }; /** - * A promise that will be resolved with that SplitView. + * A promise that resolves to a feature flag view. * @typedef {Promise} SplitView */ type SplitViewAsync = Promise; @@ -511,17 +510,17 @@ declare namespace SplitIO { */ type SplitViews = Array; /** - * A promise that will be resolved with an SplitIO.SplitViews array. + * A promise that resolves to an SplitIO.SplitViews array. * @typedef {Promise} SplitViewsAsync */ type SplitViewsAsync = Promise; /** - * An array of split names. + * An array of feature flag names. * @typedef {Array} SplitNames */ type SplitNames = Array; /** - * A promise that will be resolved with an array of split names. + * A promise that resolves to an array of feature flag names. * @typedef {Promise} SplitNamesAsync */ type SplitNamesAsync = Promise; @@ -761,7 +760,7 @@ declare namespace SplitIO { */ type UrlSettings = { /** - * String property to override the base URL where the SDK will get feature flagging related data like a Split rollout plan or segments information. + * String property to override the base URL where the SDK will get rollout plan related data, like feature flags and segments definitions. * @property {string} sdk * @default 'https://sdk.split.io/api' */ @@ -794,20 +793,23 @@ declare namespace SplitIO { /** * SplitFilter type. + * * @typedef {string} SplitFilterType */ type SplitFilterType = 'byName' | 'byPrefix'; /** - * Defines a split filter, described by a type and list of values. + * Defines a feature flag filter, described by a type and list of values. */ interface SplitFilter { /** * Type of the filter. + * * @property {SplitFilterType} type */ type: SplitFilterType, /** - * List of values: split names for 'byName' filter type, and split prefixes for 'byPrefix' type. + * List of values: feature flag names for 'byName' filter type, and feature flag name prefixes for 'byPrefix' type. + * * @property {string[]} values */ values: string[], @@ -842,7 +844,7 @@ declare namespace SplitIO { */ core: { /** - * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys} + * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys} * @property {string} authorizationKey */ authorizationKey: string, @@ -960,7 +962,7 @@ declare namespace SplitIO { */ scheduler?: { /** - * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds. + * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds. * @property {number} featuresRefreshRate * @default 60 */ @@ -1178,41 +1180,41 @@ declare namespace SplitIO { * Returns a Treatment value, which is the treatment string for the given feature. * @function getTreatment * @param {string} key - The string key representing the consumer. - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {Treatment} The treatment string. */ - getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment, + getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment, /** * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature. * @function getTreatmentWithConfig * @param {string} key - The string key representing the consumer. - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the * configuration stringified JSON (or null if there was no config for that treatment). */ - getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig, + getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig, /** * Returns a Treatments value, which is an object map with the treatments for the given features. * @function getTreatments * @param {string} key - The string key representing the consumer. - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {Treatments} The treatments object map. */ - getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments, + getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments, /** * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * @function getTreatmentsWithConfig * @param {string} key - The string key representing the consumer. - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects */ - getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): TreatmentsWithConfig, + getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig, /** - * Tracks an event to be fed to the results product on Split Webconsole. + * Tracks an event to be fed to the results product on Split user interface. * @function track * @param {SplitKey} key - The key that identifies the entity related to this event. * @param {string} trafficType - The traffic type of the entity related to this event. @@ -1235,44 +1237,44 @@ declare namespace SplitIO { * NOTE: Treatment will be a promise only in async storages, like REDIS. * @function getTreatment * @param {string} key - The string key representing the consumer. - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string. + * @returns {AsyncTreatment} Treatment promise that resolves to the treatment string. */ - getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment, + getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment, /** * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature. * For usage on NodeJS as we don't have only one key. * NOTE: Treatment will be a promise only in async storages, like REDIS. * @function getTreatmentWithConfig * @param {string} key - The string key representing the consumer. - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object. + * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object. */ - getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig, + getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig, /** * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features. * For usage on NodeJS as we don't have only one key. * @function getTreatments * @param {string} key - The string key representing the consumer. - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map. + * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map. */ - getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments, + getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments, /** * Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * For usage on NodeJS as we don't have only one key. * @function getTreatmentsWithConfig * @param {string} key - The string key representing the consumer. - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects. + * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects. */ - getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig, + getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig, /** - * Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not). + * Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not). * @function track * @param {SplitKey} key - The key that identifies the entity related to this event. * @param {string} trafficType - The traffic type of the entity related to this event. @@ -1292,37 +1294,37 @@ declare namespace SplitIO { /** * Returns a Treatment value, which is the treatment string for the given feature. * @function getTreatment - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {Treatment} The treatment string. */ - getTreatment(splitName: string, attributes?: Attributes): Treatment, + getTreatment(featureFlagName: string, attributes?: Attributes): Treatment, /** * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature. * @function getTreatmentWithConfig - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment). */ - getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig, + getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig, /** * Returns a Treatments value, which is an object map with the treatments for the given features. * @function getTreatments - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {Treatments} The treatments object map. */ - getTreatments(splitNames: string[], attributes?: Attributes): Treatments, + getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments, /** * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * @function getTreatmentsWithConfig - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects */ - getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig, + getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig, /** - * Tracks an event to be fed to the results product on Split Webconsole. + * Tracks an event to be fed to the results product on Split user interface. * @function track * @param {string} trafficType - The traffic type of the entity related to this event. * @param {string} eventType - The event type corresponding to this event. @@ -1382,37 +1384,37 @@ declare namespace SplitIO { /** * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature. * @function getTreatment - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string. + * @returns {AsyncTreatment} Treatment promise that resolves to the treatment string. */ - getTreatment(splitName: string, attributes?: Attributes): AsyncTreatment, + getTreatment(featureFlagName: string, attributes?: Attributes): AsyncTreatment, /** * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature. * @function getTreatmentWithConfig - * @param {string} splitName - The string that represents the split we wan't to get the treatment. + * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object. + * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object. */ - getTreatmentWithConfig(splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig, + getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig, /** * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features. * @function getTreatments - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map. + * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map. */ - getTreatments(splitNames: string[], attributes?: Attributes): AsyncTreatments, + getTreatments(featureFlagNames: string[], attributes?: Attributes): AsyncTreatments, /** * Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features. * @function getTreatmentsWithConfig - * @param {Array} splitNames - An array of the split names we wan't to get the treatments. + * @param {Array} featureFlagNames - An array of the feature flag names we want to get the treatments. * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects. + * @returns {TreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects. */ - getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig, + getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig, /** - * Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not). + * Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not). * @function track * @param {string} trafficType - The traffic type of the entity related to this event. * @param {string} eventType - The event type corresponding to this event. @@ -1470,13 +1472,13 @@ declare namespace SplitIO { */ interface IManager extends IStatusInterface { /** - * Get the array of Split names. + * Get the array of feature flag names. * @function names - * @returns {SplitNames} The lists of Split names. + * @returns {SplitNames} The list of feature flag names. */ names(): SplitNames, /** - * Get the array of splits data in SplitView format. + * Get the array of feature flags data in SplitView format. * @function splits * @returns {SplitViews} The list of SplitIO.SplitView. */ @@ -1484,10 +1486,10 @@ declare namespace SplitIO { /** * Get the data of a split in SplitView format. * @function split - * @param {string} splitName The name of the split we wan't to get info of. + * @param {string} featureFlagName The name of the feature flag we want to get info of. * @returns {SplitView} The SplitIO.SplitView of the given split. */ - split(splitName: string): SplitView, + split(featureFlagName: string): SplitView, } /** * Representation of a manager instance with asynchronous storage of the SDK. @@ -1496,23 +1498,23 @@ declare namespace SplitIO { */ interface IAsyncManager extends IStatusInterface { /** - * Get the array of Split names. + * Get the array of feature flag names. * @function names - * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames. + * @returns {SplitNamesAsync} A promise that resolves to the list of feature flag names. */ names(): SplitNamesAsync, /** - * Get the array of splits data in SplitView format. + * Get the array of feature flags data in SplitView format. * @function splits - * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list. + * @returns {SplitViewsAsync} A promise that resolves to the SplitIO.SplitView list. */ splits(): SplitViewsAsync, /** * Get the data of a split in SplitView format. * @function split - * @param {string} splitName The name of the split we wan't to get info of. - * @returns {SplitViewAsync} A promise that will resolve to the SplitIO.SplitView value. + * @param {string} featureFlagName The name of the feature flag we want to get info of. + * @returns {SplitViewAsync} A promise that resolves to the SplitIO.SplitView value. */ - split(splitName: string): SplitViewAsync, + split(featureFlagName: string): SplitViewAsync, } } From 9c2019a224d2dc34ad8c2b6a13c32ce5a535175a Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 10 May 2023 16:40:06 -0300 Subject: [PATCH 2/5] remove duplicated comment --- src/index.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9bbdafb..3eb4354 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,19 +1,3 @@ -/** -Copyright 2022 Split Software - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -**/ - export { SplitFactory } from './splitFactory'; export { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index'; export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GoogleAnalyticsToSplit'; From 0da64138341b5ff217d702ee55bbaadad729ef9f Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 10 May 2023 23:11:08 -0300 Subject: [PATCH 3/5] polishing --- package-lock.json | 14 +++++++------- package.json | 2 +- types/splitio.d.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c54c91..76b7934 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.9.4", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.1", + "@splitsoftware/splitio-commons": "1.8.2-rc.1", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, @@ -3279,9 +3279,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.1.tgz", - "integrity": "sha512-NHamCh+NwPTjO69kk5e6VaXjASPJzs0u3gWxITjmi0RPvGnNZ2M38/3ya1XSfARNjbDIpgHXlc1iywT07o3lEg==", + "version": "1.8.2-rc.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.1.tgz", + "integrity": "sha512-FfYsngf85hB52HH5F4obamwmQpvHAhuIzZ+n0enU8LXtQcBAdxEAH+YmzVXB/M0LLt3b9xcvZefMg88vexO9dg==", "dependencies": { "tslib": "^2.3.1" }, @@ -14300,9 +14300,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.1.tgz", - "integrity": "sha512-NHamCh+NwPTjO69kk5e6VaXjASPJzs0u3gWxITjmi0RPvGnNZ2M38/3ya1XSfARNjbDIpgHXlc1iywT07o3lEg==", + "version": "1.8.2-rc.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.1.tgz", + "integrity": "sha512-FfYsngf85hB52HH5F4obamwmQpvHAhuIzZ+n0enU8LXtQcBAdxEAH+YmzVXB/M0LLt3b9xcvZefMg88vexO9dg==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index ef5fc77..0e10364 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "bugs": "https://github.com/splitio/javascript-browser-client/issues", "homepage": "https://github.com/splitio/javascript-browser-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.1", + "@splitsoftware/splitio-commons": "1.8.2-rc.1", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 469c7e1..88f0d3c 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -363,7 +363,7 @@ declare namespace SplitIO { /** * Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig. * @typedef {Object} TreatmentWithConfig - * @property {string} treatment The treatment result + * @property {string} treatment The treatment string * @property {string | null} config The stringified version of the JSON config defined for that treatment, null if there is no config for the resulting treatment. */ type TreatmentWithConfig = { From ccd88d8d803ad2d8de0c386eb4c012c726c34325 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Fri, 12 May 2023 18:21:02 -0300 Subject: [PATCH 4/5] add changelog entry --- CHANGES.txt | 6 ++++++ package-lock.json | 18 +++++++++--------- package.json | 4 ++-- src/settings/defaults.ts | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b40e75c..ad94450 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,9 @@ +0.9.5 (May 15, 2023) + - Updated @splitsoftware/splitio-commons package to version 1.8.2 that includes minor improvements. + - 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. + 0.9.4 (May 4, 2023) - Updated some transitive dependencies for vulnerability fixes. - Bugfixing - Updated `unfetch` package as a runtime dependency, required when using the "full" entrypoint (`import { SplitFactory } from '@splitsoftware/splitio-browserjs/full'`). diff --git a/package-lock.json b/package-lock.json index 76b7934..2110b51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.4", + "version": "0.9.5-rc.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.4", + "version": "0.9.5-rc.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.2-rc.1", + "@splitsoftware/splitio-commons": "1.8.2-rc.2", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, @@ -3279,9 +3279,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.8.2-rc.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.1.tgz", - "integrity": "sha512-FfYsngf85hB52HH5F4obamwmQpvHAhuIzZ+n0enU8LXtQcBAdxEAH+YmzVXB/M0LLt3b9xcvZefMg88vexO9dg==", + "version": "1.8.2-rc.2", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.2.tgz", + "integrity": "sha512-LSBIt/dijF8YfXrCVtLCFlnZ9aeVU5wMs0KDL8GP2HD1cLspuabOSznzepNnndesmbEGZbC9bR6yE5vnawgjVA==", "dependencies": { "tslib": "^2.3.1" }, @@ -14300,9 +14300,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.8.2-rc.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.1.tgz", - "integrity": "sha512-FfYsngf85hB52HH5F4obamwmQpvHAhuIzZ+n0enU8LXtQcBAdxEAH+YmzVXB/M0LLt3b9xcvZefMg88vexO9dg==", + "version": "1.8.2-rc.2", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.2.tgz", + "integrity": "sha512-LSBIt/dijF8YfXrCVtLCFlnZ9aeVU5wMs0KDL8GP2HD1cLspuabOSznzepNnndesmbEGZbC9bR6yE5vnawgjVA==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index 0e10364..dc08290 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.4", + "version": "0.9.5-rc.0", "description": "Split SDK for JavaScript on Browser", "main": "cjs/index.js", "module": "esm/index.js", @@ -64,7 +64,7 @@ "bugs": "https://github.com/splitio/javascript-browser-client/issues", "homepage": "https://github.com/splitio/javascript-browser-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.2-rc.1", + "@splitsoftware/splitio-commons": "1.8.2-rc.2", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index eb9a3e5..990b216 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/ import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types'; import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; -const packageVersion = '0.9.4'; +const packageVersion = '0.9.5-rc.0'; /** * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. From e8412eb5fb045cfbe83065f7661da5fe08875505 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Mon, 15 May 2023 14:16:17 -0300 Subject: [PATCH 5/5] prepare stable release --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- src/settings/defaults.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2110b51..36c76f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.5-rc.0", + "version": "0.9.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.5-rc.0", + "version": "0.9.5", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.2-rc.2", + "@splitsoftware/splitio-commons": "1.8.2", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, @@ -3279,9 +3279,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.8.2-rc.2", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.2.tgz", - "integrity": "sha512-LSBIt/dijF8YfXrCVtLCFlnZ9aeVU5wMs0KDL8GP2HD1cLspuabOSznzepNnndesmbEGZbC9bR6yE5vnawgjVA==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2.tgz", + "integrity": "sha512-koR3pKQCbbh9r7guUywqJ1zXQr7ElZYVs0Ikdh+cQg21rcIx8l2sKMXxUjoizY1i2Y8D6CDW+csE9G4y9rpapQ==", "dependencies": { "tslib": "^2.3.1" }, @@ -14300,9 +14300,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.8.2-rc.2", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2-rc.2.tgz", - "integrity": "sha512-LSBIt/dijF8YfXrCVtLCFlnZ9aeVU5wMs0KDL8GP2HD1cLspuabOSznzepNnndesmbEGZbC9bR6yE5vnawgjVA==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.8.2.tgz", + "integrity": "sha512-koR3pKQCbbh9r7guUywqJ1zXQr7ElZYVs0Ikdh+cQg21rcIx8l2sKMXxUjoizY1i2Y8D6CDW+csE9G4y9rpapQ==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index dc08290..cb1c0d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-browserjs", - "version": "0.9.5-rc.0", + "version": "0.9.5", "description": "Split SDK for JavaScript on Browser", "main": "cjs/index.js", "module": "esm/index.js", @@ -64,7 +64,7 @@ "bugs": "https://github.com/splitio/javascript-browser-client/issues", "homepage": "https://github.com/splitio/javascript-browser-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.8.2-rc.2", + "@splitsoftware/splitio-commons": "1.8.2", "@types/google.analytics": "0.0.40", "unfetch": "^4.2.0" }, diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 990b216..5863505 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/ import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types'; import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; -const packageVersion = '0.9.5-rc.0'; +const packageVersion = '0.9.5'; /** * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.