Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type declarations for flag sets support #71

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
0.7.1 (October XX, 2023)
- Added support for MacOS and TvOS platforms (Related to issue https://github.com/splitio/react-native-client/issues/63).
0.8.0 (November XX, 2023)
- 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):
- Added new variations of the get treatment methods to support evaluating flags in given flag set/s.
- getTreatmentsByFlagSet and getTreatmentsByFlagSets
- getTreatmentWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets
- 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.
- Updated the SDK manager methods to expose flag sets on flag views.
- 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).
- Added support for MacOS and TvOS platforms (Related to issue https://github.com/splitio/react-native-client/issues/63).
- Updated @splitsoftware/splitio-commons package to version 1.10.0 that includes vulnerability fixes, and adds the `defaultTreatment` property to the `SplitView` object.
- Updated react-native dependency to version 0.72.6 for vulnerability fixes and validation.

Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-react-native",
"version": "0.7.1-rc.1",
"version": "0.7.1-rc.2",
"description": "Split SDK for React Native",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
Expand All @@ -20,10 +20,15 @@
"RNSplit.podspec",
"full",
"!android/build",
"!android/gradle",
"!android/gradlew",
"!android/gradlew.bat",
"!android/local.properties",
"!ios/build",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__"
"!**/__mocks__",
"!**/.*"
],
"scripts": {
"check": "npm run check:lint && npm run check:types && npm run check:version",
Expand Down Expand Up @@ -55,7 +60,7 @@
},
"homepage": "https://github.com/splitio/react-native-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.10.0"
"@splitsoftware/splitio-commons": "1.10.1-rc.0"
},
"devDependencies": {
"@react-native-community/eslint-config": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/settings/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConsentStatus } from '@splitsoftware/splitio-commons/src/types';
import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';

const packageVersion = '0.7.1-rc.1';
const packageVersion = '0.7.1-rc.2';

export const defaults = {
startup: {
Expand Down
117 changes: 115 additions & 2 deletions types/splitio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ declare namespace SplitIO {
configs: {
[treatmentName: string]: string
},
/**
* List of sets of the feature flag.
* @property {string[]} sets
*/
sets: string[],
/**
* The default treatment of the feature flag.
* @property {string} defaultTreatment
Expand Down Expand Up @@ -627,7 +632,7 @@ declare namespace SplitIO {
*
* @typedef {string} SplitFilterType
*/
type SplitFilterType = 'byName' | 'byPrefix';
type SplitFilterType = 'bySet' | 'byName' | 'byPrefix';
/**
* Defines a feature flag filter, described by a type and list of values.
*/
Expand Down Expand Up @@ -899,6 +904,42 @@ declare namespace SplitIO {
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
*/
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
/**
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
* @function getTreatmentsByFlagSet
* @param {string} key - The string key representing the consumer.
* @param {string} flagSet - The flag set name we want to get the treatments.
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
* @returns {Treatments} The map with all the Treatment objects
*/
getTreatmentsByFlagSet(key: SplitKey, flagSet: 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 feature flags related to the given flag set.
* @function getTreatmentsWithConfigByFlagSet
* @param {string} key - The string key representing the consumer.
* @param {string} flagSet - The flag set name 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
*/
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
/**
* Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
* @function getTreatmentsByFlagSets
* @param {string} key - The string key representing the consumer.
* @param {Array<string>} flagSets - An array of the flag set 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 map with all the Treatment objects
*/
getTreatmentsByFlagSets(key: SplitKey, flagSets: 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 feature flags related to the given flag sets.
* @function getTreatmentsWithConfigByFlagSets
* @param {string} key - The string key representing the consumer.
* @param {Array<string>} flagSets - An array of the flag set 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
*/
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
/**
* Tracks an event to be fed to the results product on Split user interface.
* @function track
Expand All @@ -913,7 +954,7 @@ declare namespace SplitIO {
}
/**
* This represents the interface for the Client instance with asynchronous storage for server-side SDK, where we don't have only one key.
* @interface IAsyncClient
* @interface IAsyncClientSS
* @extends IBasicClient
*/
interface IAsyncClientSS extends IBasicClient {
Expand Down Expand Up @@ -959,6 +1000,46 @@ declare namespace SplitIO {
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
*/
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
/**
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
* For usage on NodeJS as we don't have only one key.
* @function getTreatmentsByFlagSet
* @param {string} key - The string key representing the consumer.
* @param {string} flagSet - The flag set name 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 that resolves to the treatments object map.
*/
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments,
/**
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
* For usage on NodeJS as we don't have only one key.
* @function getTreatmentsWithConfigByFlagSet
* @param {string} key - The string key representing the consumer.
* @param {string} flagSet - The flag set name 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 that resolves to the map of TreatmentsWithConfig objects.
*/
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentWithConfig,
/**
* Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
* For usage on NodeJS as we don't have only one key.
* @function getTreatmentsByFlagSets
* @param {string} key - The string key representing the consumer.
* @param {Array<string>} flagSets - An array of the flag set 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 that resolves to the treatments object map.
*/
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments,
/**
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
* For usage on NodeJS as we don't have only one key.
* @function getTreatmentsWithConfigByFlagSets
* @param {string} key - The string key representing the consumer.
* @param {Array<string>} flagSets - An array of the flag set 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 that resolves to the map of TreatmentsWithConfig objects.
*/
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentWithConfig,
/**
* 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
Expand Down Expand Up @@ -1009,6 +1090,38 @@ declare namespace SplitIO {
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
*/
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
/**
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
* @function getTreatmentsByFlagSet
* @param {string} flagSet - The flag set name we want to get the treatments.
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
* @returns {Treatments} The map with all the Treatments objects
*/
getTreatmentsByFlagSet(flagSet: 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 feature flags related to the given flag set.
* @function getTreatmentsWithConfigByFlagSet
* @param {string} flagSet - The flag set name 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
*/
getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
/**
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
* @function getTreatmentsByFlagSets
* @param {Array<string>} flagSets - An array of the flag set 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 map with all the Treatments objects
*/
getTreatmentsByFlagSets(flagSets: 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 feature flags related to the given flag sets.
* @function getTreatmentsWithConfigByFlagSets
* @param {Array<string>} flagSets - An array of the flag set 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
*/
getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
/**
* Tracks an event to be fed to the results product on Split user interface.
* @function track
Expand Down