From 1e25ff8b1abf6a814d97d5c581f4976cc844ca4b Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Mon, 7 Mar 2022 18:07:45 -0300 Subject: [PATCH 01/12] configs and dependencies updates, and other improvements --- LICENSE | 2 +- README.md | 4 ++-- package-lock.json | 32 +++++++++++++------------------- package.json | 9 ++++----- src/full/splitFactory.ts | 11 ++++++----- src/index.ts | 16 ++++++++++++++++ src/platform/RNSignalListener.ts | 23 +++++++++++++---------- src/platform/getModules.ts | 6 +++--- src/settings/defaults.ts | 2 +- src/settings/full.ts | 2 ++ src/settings/index.ts | 2 ++ src/splitFactory.ts | 11 ++++++----- 12 files changed, 69 insertions(+), 51 deletions(-) diff --git a/LICENSE b/LICENSE index 18dec1b..051b5fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2021 Split Software, Inc. +Copyright © 2022 Split Software, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 8bc20c7..056ec74 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Split JavaScript SDK for React Native -[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://travis-ci.com/splitio/react-native-client.svg?branch=main)](https://travis-ci.com/splitio/react-native-client) +[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://github.com/splitio/react-native-client/actions/workflows/ci.yml/badge.svg)](https://github.com/splitio/react-native-client/actions/workflows/ci.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. @@ -62,8 +62,8 @@ Split has built and maintains SDKs for: * iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK) * Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) * Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) -* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) * Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK) +* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) * PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) * Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK) * React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK) diff --git a/package-lock.json b/package-lock.json index ec834d9..82467f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.0", + "version": "0.1.1-rc.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3555,12 +3555,11 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.0.0.tgz", - "integrity": "sha512-hup5YVuf9eEd9FJix7siGhFgsUJndCfeMwTLNeO+mPL2gehjGZLS0GjOMofVAa+Y1cDrpo41CQ54w/QIbixYQg==", + "version": "1.2.1-rc.4", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.4.tgz", + "integrity": "sha512-C+CVlo8b3K6gR3JnxPdB8AbMrlb6NWRUO2TZy7Mq7LaeJBr2I1BeVlphN817/EUbZi2bPl98DiypWaJFmg8Ocw==", "requires": { - "object-assign": "^4.1.1", - "tslib": "^2.1.0" + "tslib": "^2.3.1" }, "dependencies": { "tslib": { @@ -3789,12 +3788,6 @@ "integrity": "sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==", "dev": true }, - "@types/object-assign": { - "version": "4.0.30", - "resolved": "https://registry.npmjs.org/@types/object-assign/-/object-assign-4.0.30.tgz", - "integrity": "sha1-iUk3HVqZ9Dge4PHfCpt6GH4H5lI=", - "dev": true - }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -3825,9 +3818,9 @@ } }, "@types/react-native": { - "version": "0.62.13", - "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.62.13.tgz", - "integrity": "sha512-hs4/tSABhcJx+J8pZhVoXHrOQD89WFmbs8QiDLNSA9zNrD46pityAuBWuwk1aMjPk9I3vC5ewkJroVRHgRIfdg==", + "version": "0.65.1", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.65.1.tgz", + "integrity": "sha512-pyRmTnvjYORIXuL8+ZhoI8gqamTE/8Lo9bU/1Ife3VOTgeFzY9rHnx3Tna7OOixBW5Exh2PcHSkJXma4FENC0g==", "dev": true, "requires": { "@types/react": "*" @@ -11991,7 +11984,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -14579,9 +14573,9 @@ } }, "typescript": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz", - "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, "uglify-es": { diff --git a/package.json b/package.json index a9da112..91ed8f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.0", + "version": "0.1.1-rc.0", "description": "Split SDK for React Native", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", @@ -54,14 +54,13 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.0.0" + "@splitsoftware/splitio-commons": "1.2.1-rc.4" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", "@types/jest": "^27.0.2", - "@types/object-assign": "^4.0.30", "@types/react": "^16.9.19", - "@types/react-native": "0.62.13", + "@types/react-native": "0.65.1", "eslint": "^7.2.0", "eslint-config-prettier": "^7.0.0", "eslint-plugin-import": "^2.23.4", @@ -73,7 +72,7 @@ "react-native": "^0.65.1", "react-native-builder-bob": "^0.18.1", "replace": "^1.2.1", - "typescript": "^4.1.3" + "typescript": "4.4.4" }, "peerDependencies": { "react": "*", diff --git a/src/full/splitFactory.ts b/src/full/splitFactory.ts index 1c92de6..a5d6f77 100644 --- a/src/full/splitFactory.ts +++ b/src/full/splitFactory.ts @@ -2,18 +2,19 @@ import { settingsValidator } from '../settings/full'; import { getModules } from '../platform/getModules'; import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index'; import type { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { merge } from '@splitsoftware/splitio-commons/src/utils/lang'; /** * SplitFactory for React Native. * Includes localhost mode. * - * @param config Configuration object used to instantiates the SDK - * @param customModules Optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. + * @param config Configuration object used to instantiate the SDK + * @param __updateModules Optional function that lets redefine internal SDK modules. Use with + * caution since, unlike `config`, this param is not validated neither considered part of the public API. * @throws Will throw an error if the provided config is invalid. */ -export function SplitFactory(config: any, customModules?: Partial) { +export function SplitFactory(config: any, __updateModules: (modules: ISdkFactoryParams) => void) { const settings = settingsValidator(config); const modules = getModules(settings); - return sdkFactory(customModules ? (merge(modules, customModules) as ISdkFactoryParams) : modules); + if (__updateModules) __updateModules(modules); + return sdkFactory(modules); } diff --git a/src/index.ts b/src/index.ts index 1cbaec6..7e7f9af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,19 @@ +/** +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 { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger'; export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger'; diff --git a/src/platform/RNSignalListener.ts b/src/platform/RNSignalListener.ts index e75b4c8..0413411 100644 --- a/src/platform/RNSignalListener.ts +++ b/src/platform/RNSignalListener.ts @@ -44,9 +44,11 @@ export class RNSignalListener implements ISignalListener { case TO_FOREGROUND: this.settings.log.debug(`App transition to foreground${this.syncManager.pushManager ? '. Attempting to resume streaming' : ''}`); - // This branch is called when app transition to foreground or it is launched, - // in which case calling pushManager.start has no effect (it has been already started). - // Here, synchronization is resumed. + // This branch is called when (1) app is launched, or (2) app transitions to foreground. + // In 1, calling pushManager.start has no effect, since it has already been started. + // In 2, PushManager is resumed in case it was paused and the SDK is running in push mode. + // If running in polling mode, either pushManager is not defined (e.g., streamingEnabled is false) + // or calling pushManager.start has no effect because it was disabled (PUSH_NONRETRYABLE_ERROR). if (this.syncManager.pushManager) this.syncManager.pushManager.start(); break; @@ -58,15 +60,16 @@ export class RNSignalListener implements ISignalListener { ); // This branch is called when the app transition to background. - // Here, pushManager is stopped to close streaming connections for Android. - // In iOS, connections are automatically closed/resumed by the OS. - // Polling mode is paused during background, since JS timers callbacks are executed only - // when the app is in the foreground. Therefore, stopping syncManager is not necessary. - // Other features like Fetch, AsyncStorage, AppState and NetInfo listeners, can be used. + // Here, PushManager is paused in case the SDK is running in push mode, to close streaming connection for Android. + // In iOS it is not strictly required, since connections are automatically closed/resumed by the OS. + // The remaining SyncManager components (PollingManager and Submitter) don't need to be stopped, even if running in + // polling mode, because sync tasks are "delayed" during background, since JS timers callbacks are executed only + // when the app is in foreground (https://github.com/facebook/react-native/issues/12981#issuecomment-652745831). + // Other features like Fetch, AsyncStorage, AppState and NetInfo listeners, can be used in background. if (this.syncManager.pushManager) this.syncManager.pushManager.stop(); // We cannot listen when the app is evicted by the OS or the user, but it always transitions to background before that. - // So we should not flush events and impressions in the background, except that they cannot be stored in a persistent storage. + // So we should not flush events and impressions in background, except that they cannot be stored in a persistent storage. if (this.settings.flushDataOnBackground) this.syncManager.flush(); break; @@ -79,7 +82,7 @@ export class RNSignalListener implements ISignalListener { */ start() { this.settings.log.debug(CLEANUP_REGISTERING, [EVENT_NAME]); - // Checking currentState in the rare case that the SDK is instantiated in the background, where streaming should not connect. + // Checking currentState in the rare case that the SDK is instantiated in background, where streaming should not connect. // The SDK should be instantiated when React Native JS context is initiated or the root componentDidMount method is called, where the app is in the foreground. this._handleAppStateChange(AppState.currentState); AppState.addEventListener('change', this._handleAppStateChange); diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 6fb3a9a..188509f 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -1,11 +1,11 @@ import { splitApiFactory } from '@splitsoftware/splitio-commons/src/services/splitApi'; import { syncManagerOnlineFactory } from '@splitsoftware/splitio-commons/src/sync/syncManagerOnline'; -import pushManagerFactory from '@splitsoftware/splitio-commons/src/sync/streaming/pushManager'; -import pollingManagerCSFactory from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerCS'; +import { pushManagerFactory } from '@splitsoftware/splitio-commons/src/sync/streaming/pushManager'; +import { pollingManagerCSFactory } from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerCS'; import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager/index'; import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS'; import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS'; -import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents'; +import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents'; import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils'; import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 6d8a7d7..d7d5e08 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -1,4 +1,4 @@ -const packageVersion = '0.1.0'; +const packageVersion = '0.1.1-rc.0'; export const defaults = { startup: { diff --git a/src/settings/full.ts b/src/settings/full.ts index 3cc6702..965af6a 100644 --- a/src/settings/full.ts +++ b/src/settings/full.ts @@ -1,5 +1,6 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index'; import { defaults } from './defaults'; +import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime'; import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS'; import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; @@ -7,6 +8,7 @@ import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/src const params = { defaults, + runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, diff --git a/src/settings/index.ts b/src/settings/index.ts index d495033..23f7c8b 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -1,5 +1,6 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index'; import { defaults } from './defaults'; +import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime'; import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS'; import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; @@ -7,6 +8,7 @@ import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/sett const params = { defaults, + runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, diff --git a/src/splitFactory.ts b/src/splitFactory.ts index fa72775..fa4d022 100644 --- a/src/splitFactory.ts +++ b/src/splitFactory.ts @@ -2,18 +2,19 @@ import { settingsValidator } from './settings'; import { getModules } from './platform/getModules'; import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index'; import type { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { merge } from '@splitsoftware/splitio-commons/src/utils/lang'; /** * Slim SplitFactory for React Native. * Doesn't include localhost mode out-of-the-box. * - * @param config Configuration object used to instantiates the SDK - * @param customModules Optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. + * @param config Configuration object used to instantiate the SDK + * @param __updateModules Optional function that lets redefine internal SDK modules. Use with + * caution since, unlike `config`, this param is not validated neither considered part of the public API. * @throws Will throw an error if the provided config is invalid. */ -export function SplitFactory(config: any, customModules?: Partial) { +export function SplitFactory(config: any, __updateModules: (modules: ISdkFactoryParams) => void) { const settings = settingsValidator(config); const modules = getModules(settings); - return sdkFactory(customModules ? (merge(modules, customModules) as ISdkFactoryParams) : modules); + if (__updateModules) __updateModules(modules); + return sdkFactory(modules); } From c168652b30ed8eaf692ff2b5c771a39fa3512f3b Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 8 Mar 2022 13:37:32 -0300 Subject: [PATCH 02/12] user consent and attributes binding integration, E2E tests and type definitions --- package-lock.json | 6 +- package.json | 2 +- src/platform/getModules.ts | 3 + src/settings/__tests__/index.spec.ts | 18 +++ src/settings/defaults.ts | 6 + src/settings/full.ts | 2 + src/settings/index.ts | 2 + types/index.d.ts | 2 +- types/splitio.d.ts | 175 ++++++++++++++++++++------- 9 files changed, 170 insertions(+), 46 deletions(-) create mode 100644 src/settings/__tests__/index.spec.ts diff --git a/package-lock.json b/package-lock.json index 82467f1..77c0c39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.4", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.4.tgz", - "integrity": "sha512-C+CVlo8b3K6gR3JnxPdB8AbMrlb6NWRUO2TZy7Mq7LaeJBr2I1BeVlphN817/EUbZi2bPl98DiypWaJFmg8Ocw==", + "version": "1.2.1-rc.7", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.7.tgz", + "integrity": "sha512-Gt/13cofHzKQIryuwDRBD1yeOppY04KeRxGrHH8KJBb4HhXbgA87yScCfStmn+P0hgTNfFrBHm5QlGLmQ8XDqw==", "requires": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index 91ed8f3..d263be8 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.4" + "@splitsoftware/splitio-commons": "1.2.1-rc.7" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 188509f..28387ec 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -11,6 +11,7 @@ import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impress import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types'; import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants'; +import { userConsentProps } from '@splitsoftware/splitio-commons/src/sdkFactory/userConsentProps'; import { RNSignalListener } from './RNSignalListener'; import { getEventSource } from './getEventSource'; @@ -47,6 +48,8 @@ export function getModules(settings: ISettings): ISdkFactoryParams { impressionListener: settings.impressionListener as SplitIO.IImpressionListener, impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined, + + extraProps: userConsentProps, }; if (settings.mode === LOCALHOST_MODE) { diff --git a/src/settings/__tests__/index.spec.ts b/src/settings/__tests__/index.spec.ts new file mode 100644 index 0000000..a9fc014 --- /dev/null +++ b/src/settings/__tests__/index.spec.ts @@ -0,0 +1,18 @@ +import { settingsValidator as slimSettingsValidator } from '../index'; +import { settingsValidator as fullSettingsValidator } from '../index'; + +test('SETTINGS / Consent is overwritable and "GRANTED" by default', () => { + [slimSettingsValidator, fullSettingsValidator].forEach((settingsValidator) => { + let settings = settingsValidator({}); + expect(settings.userConsent).toEqual('GRANTED'); // userConsent defaults to granted if not provided + + settings = settingsValidator({ userConsent: 'INVALID-VALUE' }); + expect(settings.userConsent).toEqual('GRANTED'); // userConsent defaults to granted if a wrong value is provided + + settings = settingsValidator({ userConsent: 'UNKNOWN' }); + expect(settings.userConsent).toEqual('UNKNOWN'); // userConsent can be overwritten + + settings = settingsValidator({ userConsent: 'declined' }); + expect(settings.userConsent).toEqual('DECLINED'); // userConsent can be overwritten + }); +}); diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index d7d5e08..90535be 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -1,3 +1,6 @@ +import { ConsentStatus } from '@splitsoftware/splitio-commons/src/types'; +import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; + const packageVersion = '0.1.1-rc.0'; export const defaults = { @@ -12,6 +15,9 @@ export const defaults = { eventsFirstPushWindow: 10, }, + // Consent is considered granted by default + userConsent: CONSENT_GRANTED as ConsentStatus, + // Instance version. version: `reactnative-${packageVersion}`, diff --git a/src/settings/full.ts b/src/settings/full.ts index 965af6a..4c9c829 100644 --- a/src/settings/full.ts +++ b/src/settings/full.ts @@ -5,6 +5,7 @@ import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/sett import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/builtin'; +import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent'; const params = { defaults, @@ -14,6 +15,7 @@ const params = { logger: validateLogger, // Full SplitFactory returns a default instance, except a valid one is provided localhost: validateLocalhostWithDefault, + consent: validateConsent, }; export function settingsValidator(config: any) { diff --git a/src/settings/index.ts b/src/settings/index.ts index 23f7c8b..e99d688 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -5,6 +5,7 @@ import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/sett import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/pluggable'; +import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent'; const params = { defaults, @@ -14,6 +15,7 @@ const params = { logger: validateLogger, // Slim SplitFactory validates that the localhost module is passed in localhost mode localhost: validateLocalhost, + consent: validateConsent, }; export function settingsValidator(config: any) { diff --git a/types/index.d.ts b/types/index.d.ts index 4cac88b..3421e25 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,4 +1,4 @@ -// Declaration file for React Native Split Software SDK v1.0.0 +// Declaration file for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 9f0a707..67d0fa4 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Native Split Software SDK v1.0.0 +// Type definitions for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya @@ -9,11 +9,11 @@ export = SplitIO; * EventEmitter interface based on a subset of the NodeJS.EventEmitter methods. */ interface IEventEmitter { - addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: string, listener: (...args: any[]) => void): this on(event: string, listener: (...args: any[]) => void): this once(event: string, listener: (...args: any[]) => void): this - removeListener(event: string, listener: (...args: any[]) => void): this; - off(event: string, listener: (...args: any[]) => void): this; + removeListener(event: string, listener: (...args: any[]) => void): this + off(event: string, listener: (...args: any[]) => void): this removeAllListeners(event?: string): this emit(event: string, ...args: any[]): boolean } @@ -50,6 +50,7 @@ interface ISettings { readonly scheduler: { featuresRefreshRate: number, impressionsRefreshRate: number, + impressionsQueueSize: number, segmentsRefreshRate: number, offlineRefreshRate: number, eventsPushRate: number, @@ -81,7 +82,8 @@ interface ISettings { splitFilters: SplitIO.SplitFilter[], impressionsMode: SplitIO.ImpressionsMode, localhostMode?: SplitIO.LocalhostFactory - } + }, + readonly userConsent: SplitIO.ConsentStatus } /** * Log levels. @@ -181,7 +183,7 @@ interface ISharedSettings { */ impressionsMode?: SplitIO.ImpressionsMode, /** - * Defines the factory function to instanciate the SDK in localhost mode. + * Defines the factory function to instantiate the SDK in localhost mode. * * NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode. * @@ -334,12 +336,17 @@ 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). - * @typedef {Object.} Attributes + * @typedef {Object.} Attributes * @see {@link https://help.split.io/hc/en-us/articles/4406066357901#attribute-syntax} */ type Attributes = { - [attributeName: string]: string | number | boolean | Array + [attributeName: string]: AttributeType }; + /** + * Type of an attribute value + * @typedef {string | number | boolean | Array} AttributeType + */ + 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. * @typedef {Object.} Attributes @@ -495,7 +502,10 @@ declare namespace SplitIO { * By returning an integration, the SDK will queue events and impressions into it. * Input parameter details are not part of the public API. */ - type IntegrationFactory = (params: {}) => (Integration | void) + type IntegrationFactory = { + readonly type: string + (params: {}): (Integration | void) + } /** * A pair of user key and it's trafficType, required for tracking valid Split events. * @typedef {Object} Identity @@ -580,6 +590,11 @@ declare namespace SplitIO { * @typedef {string} ImpressionsMode */ type ImpressionsMode = 'OPTIMIZED' | 'DEBUG'; + /** + * User consent status. + * @typedef {string} ConsentStatus + */ + type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN'; /** * Logger * Its interface details are not part of the public API. It shouldn't be used directly. @@ -644,6 +659,13 @@ declare namespace SplitIO { * @default 60 */ impressionsRefreshRate?: number, + /** + * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer. + * If you use a 0 here, the queue will have no maximum size. + * @property {number} impressionsQueueSize + * @default 30000 + */ + impressionsQueueSize?: number, /** * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds. * @property {number} segmentsRefreshRate @@ -723,6 +745,17 @@ declare namespace SplitIO { * @todo at the moment there are not integrations to plug in React Native SDK. */ integrations?: IntegrationFactory[], + /** + * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`. + * - `'GRANTED'`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. + * - `'DECLINED'`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. + * - `'UNKNOWN'`: the user has neither granted nor declined consent for tracking events and impressions. The SDK will track them in its internal storage, and eventually send + * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `setUserConsent` factory method. + * + * @typedef {string} userConsent + * @default 'GRANTED' + */ + userConsent?: ConsentStatus } /** * This represents the interface for the SDK instance with synchronous storage and client-side API, @@ -732,13 +765,13 @@ declare namespace SplitIO { */ export interface ISDK extends IBasicSDK { /** - * Returns the default client instance of the SDK, associated with the key and optional traffic type from settings. + * Returns the default client instance of the SDK, associated with the key provided on settings. * @function client * @returns {IClient} The client instance. */ client(): IClient, /** - * Returns a shared client of the SDK, associated with the given key and optional traffic type. + * Returns a shared client of the SDK, associated with the given key. * @function client * @param {SplitKey} key The key for the new client instance. * @returns {IClient} The client instance. @@ -749,7 +782,26 @@ declare namespace SplitIO { * @function manager * @returns {IManager} The manager instance. */ - manager(): IManager + manager(): IManager, + /** + * Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively. + * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. + * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. + * + * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory. + * + * @function setUserConsent + * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'. + * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not. + */ + setUserConsent(userConsent: boolean): boolean; + /** + * Get the user consent status. + * + * @function getUserConsent + * @returns {ConsentStatus} The user consent status. + */ + getUserConsent(): SplitIO.ConsentStatus; } /** @@ -759,35 +811,35 @@ declare namespace SplitIO { */ interface IClientSS extends IBasicClient { /** - * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment or treatment promise which will resolve to the treatment string. + * @returns {Treatment} The treatment string. */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value (a map of treatment and config), which will be (or eventually be) the map with treatment and config for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The TreatmentWithConfig or TreatmentWithConfig promise which will resolve to the map containing - * the treatment and the configuration stringified JSON (or null if there was no config for that treatment). + * @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, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * 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. @@ -803,7 +855,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, } @@ -825,7 +877,7 @@ declare namespace SplitIO { */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment, /** - * Returns a TreatmentWithConfig value, which will be (or eventually be) a map with both treatment and config string for the given feature. + * 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 @@ -836,17 +888,17 @@ declare namespace SplitIO { */ getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {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. + * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments, /** - * Returns a Treatments value, whick will be (or eventually be) an object with all the maps of treatment and config string for the given features. + * 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. @@ -863,7 +915,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue succesfully or not. + * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise } @@ -874,31 +926,31 @@ declare namespace SplitIO { */ interface IClient extends IBasicClient { /** - * Returns a Treatment value, which will be the treatment string for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment result. + * @returns {Treatment} The treatment string. */ getTreatment(splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value, which will be a map of treatment and the config for that treatment. - * @function getTreatment + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The treatment or treatment promise which will resolve to the treatment string. + * @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, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. @@ -912,9 +964,50 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, + /** + * Add an attribute to client's in memory attributes storage. + * + * @param {string} attributeName Attribute name + * @param {AttributeType} attributeValue Attribute value + * @returns {boolean} true if the attribute was stored and false otherwise + */ + setAttribute(attributeName: string, attributeValue: AttributeType): boolean, + /** + * Returns the attribute with the given key. + * + * @param {string} attributeName Attribute name + * @returns {AttributeType} Attribute with the given key + */ + getAttribute(attributeName: string): AttributeType, + /** + * Removes from client's in memory attributes storage the attribute with the given key. + * + * @param {string} attributeName + * @returns {boolean} true if attribute was removed and false otherwise + */ + removeAttribute(attributeName: string): boolean, + /** + * Add to client's in memory attributes storage the attributes in 'attributes'. + * + * @param {Attributes} attributes Object with attributes to store + * @returns true if attributes were stored an false otherwise + */ + setAttributes(attributes: Attributes): boolean, + /** + * Return all the attributes stored in client's in memory attributes storage. + * + * @returns {Attributes} returns all the stored attributes + */ + getAttributes(): Attributes, + /** + * Remove all the stored attributes in the client's in memory attribute storage. + * + * @returns {boolean} true if all attribute were removed and false otherwise + */ + clearAttributes(): boolean, } /** * Representation of a manager instance with synchronous storage of the SDK. @@ -927,20 +1020,20 @@ declare namespace SplitIO { * @function names * @returns {SplitNames} The lists of Split names. */ - names(): SplitNames; + names(): SplitNames, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViews} The list of SplitIO.SplitView. */ - splits(): SplitViews; + splits(): SplitViews, /** * 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 {SplitView} The SplitIO.SplitView of the given split. */ - split(splitName: string): SplitView; + split(splitName: string): SplitView, } /** * Representation of a manager instance with asynchronous storage of the SDK. @@ -953,19 +1046,19 @@ declare namespace SplitIO { * @function names * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames. */ - names(): SplitNamesAsync; + names(): SplitNamesAsync, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list. */ - splits(): SplitViewsAsync; + 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. */ - split(splitName: string): SplitViewAsync; + split(splitName: string): SplitViewAsync, } } From c6d72382eb00999e4b4d46b90e2a0dada872d8d1 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 8 Mar 2022 18:14:18 -0300 Subject: [PATCH 03/12] upgrade js-commons --- package-lock.json | 6 +++--- package.json | 2 +- src/platform/getModules.ts | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77c0c39..c78df0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.7", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.7.tgz", - "integrity": "sha512-Gt/13cofHzKQIryuwDRBD1yeOppY04KeRxGrHH8KJBb4HhXbgA87yScCfStmn+P0hgTNfFrBHm5QlGLmQ8XDqw==", + "version": "1.2.1-rc.8", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.8.tgz", + "integrity": "sha512-K/qQZqBaJa4fssNJgTWtBMkWFlwJBKemSHhhlF+8hQnOv8Tra4tAz7ObPQwnZ9Esjdmd2jEd2SJ1LeSi9haIqQ==", "requires": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index d263be8..da59fed 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.7" + "@splitsoftware/splitio-commons": "1.2.1-rc.8" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 28387ec..76650af 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -9,7 +9,7 @@ import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils'; import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types'; +import { ISettings } from '@splitsoftware/splitio-commons/src/types'; import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants'; import { userConsentProps } from '@splitsoftware/splitio-commons/src/sdkFactory/userConsentProps'; @@ -45,8 +45,6 @@ export function getModules(settings: ISettings): ISdkFactoryParams { SignalListener: RNSignalListener as ISdkFactoryParams['SignalListener'], - impressionListener: settings.impressionListener as SplitIO.IImpressionListener, - impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined, extraProps: userConsentProps, From 4aa9fb8ede56fc49b38140b6e97e6e9beb64a362 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Mon, 14 Mar 2022 17:44:58 -0300 Subject: [PATCH 04/12] fixed comment in type definition --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 4cac88b..2d03ea9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,7 +12,7 @@ declare module JsSdk { * Recommended to use for bundle size reduction in production, since it doesn't include localhost mode out-of-the-box * @see {@link https://help.split.io/hc/en-us/articles/4406066357901#localhost-mode}. * - * The settings parameter should be an object that complies with the SplitIO.IBrowserSettings. + * The settings parameter should be an object that complies with the SplitIO.IReactNativeSettings. * For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/4406066357901#configuration} */ export function SplitFactory(settings: SplitIO.IReactNativeSettings): SplitIO.ISDK; From eb99de370a0afc67df26bfc46b6bc7748c0e7044 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 29 Mar 2022 15:47:38 -0300 Subject: [PATCH 05/12] fix issue with core.key not being validated --- package-lock.json | 6 +++--- package.json | 2 +- src/settings/full.ts | 4 ++-- src/settings/index.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c78df0d..20f38ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.8", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.8.tgz", - "integrity": "sha512-K/qQZqBaJa4fssNJgTWtBMkWFlwJBKemSHhhlF+8hQnOv8Tra4tAz7ObPQwnZ9Esjdmd2jEd2SJ1LeSi9haIqQ==", + "version": "1.2.1-rc.10", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.10.tgz", + "integrity": "sha512-Ne+0bUkKy1XBd4cI8BObcMP5jr1d+v98JzND0AHUVOuie2U6J9bvuZ+HBUvO7bhu9aSD0etjnip6dyK9CFrkGA==", "requires": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index da59fed..e574f3e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.8" + "@splitsoftware/splitio-commons": "1.2.1-rc.10" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", diff --git a/src/settings/full.ts b/src/settings/full.ts index 4c9c829..0ce7c37 100644 --- a/src/settings/full.ts +++ b/src/settings/full.ts @@ -9,12 +9,12 @@ import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settin const params = { defaults, + acceptKey: true, // Client with bound key runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, - // Full SplitFactory returns a default instance, except a valid one is provided - localhost: validateLocalhostWithDefault, + localhost: validateLocalhostWithDefault, // Full SplitFactory provides a default localhost module, except a valid one is provided consent: validateConsent, }; diff --git a/src/settings/index.ts b/src/settings/index.ts index e99d688..00f939f 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -9,12 +9,12 @@ import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settin const params = { defaults, + acceptKey: true, // Client with bound key runtime: validateRuntime, storage: validateStorageCS, integrations: validatePluggableIntegrations, logger: validateLogger, - // Slim SplitFactory validates that the localhost module is passed in localhost mode - localhost: validateLocalhost, + localhost: validateLocalhost, // Slim SplitFactory validates that the localhost module is passed in localhost mode consent: validateConsent, }; From aff470449524b3389b8f6dafb0bd62ea1591f526 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 30 Mar 2022 11:28:59 -0300 Subject: [PATCH 06/12] upgraded JS-commons. fixed some typos in type definitions --- package-lock.json | 6 +++--- package.json | 2 +- src/platform/getModules.ts | 4 +--- src/settings/full.ts | 1 + src/settings/index.ts | 1 + types/full/index.d.ts | 2 +- types/index.d.ts | 2 +- types/splitio.d.ts | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82467f1..20f38ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.4", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.4.tgz", - "integrity": "sha512-C+CVlo8b3K6gR3JnxPdB8AbMrlb6NWRUO2TZy7Mq7LaeJBr2I1BeVlphN817/EUbZi2bPl98DiypWaJFmg8Ocw==", + "version": "1.2.1-rc.10", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.10.tgz", + "integrity": "sha512-Ne+0bUkKy1XBd4cI8BObcMP5jr1d+v98JzND0AHUVOuie2U6J9bvuZ+HBUvO7bhu9aSD0etjnip6dyK9CFrkGA==", "requires": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index 91ed8f3..e574f3e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.4" + "@splitsoftware/splitio-commons": "1.2.1-rc.10" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 188509f..f44d0cf 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -9,7 +9,7 @@ import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils'; import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; -import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types'; +import { ISettings } from '@splitsoftware/splitio-commons/src/types'; import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants'; import { RNSignalListener } from './RNSignalListener'; @@ -44,8 +44,6 @@ export function getModules(settings: ISettings): ISdkFactoryParams { SignalListener: RNSignalListener as ISdkFactoryParams['SignalListener'], - impressionListener: settings.impressionListener as SplitIO.IImpressionListener, - impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined, }; diff --git a/src/settings/full.ts b/src/settings/full.ts index 965af6a..13146d7 100644 --- a/src/settings/full.ts +++ b/src/settings/full.ts @@ -14,6 +14,7 @@ const params = { logger: validateLogger, // Full SplitFactory returns a default instance, except a valid one is provided localhost: validateLocalhostWithDefault, + consent: () => undefined, // @TODO replace to support user consent }; export function settingsValidator(config: any) { diff --git a/src/settings/index.ts b/src/settings/index.ts index 23f7c8b..785b375 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -14,6 +14,7 @@ const params = { logger: validateLogger, // Slim SplitFactory validates that the localhost module is passed in localhost mode localhost: validateLocalhost, + consent: () => undefined, // @TODO replace to support user consent }; export function settingsValidator(config: any) { diff --git a/types/full/index.d.ts b/types/full/index.d.ts index d3283a6..13bf73d 100644 --- a/types/full/index.d.ts +++ b/types/full/index.d.ts @@ -1,4 +1,4 @@ -// Declaration file for React Native Split Software SDK v1.0.0 +// Declaration file for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya diff --git a/types/index.d.ts b/types/index.d.ts index 2d03ea9..655da3e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,4 +1,4 @@ -// Declaration file for React Native Split Software SDK v1.0.0 +// Declaration file for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 9f0a707..6f73f5d 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -181,7 +181,7 @@ interface ISharedSettings { */ impressionsMode?: SplitIO.ImpressionsMode, /** - * Defines the factory function to instanciate the SDK in localhost mode. + * Defines the factory function to instantiate the SDK in localhost mode. * * NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode. * @@ -706,7 +706,7 @@ declare namespace SplitIO { */ features?: MockedFeaturesMap, /** - * Defines the factory function to instanciate the storage. If not provided, the default IN MEMORY storage is used. + * Defines the factory function to instantiate the storage. If not provided, the default IN MEMORY storage is used. * @property {Object} storage * @todo at the moment there are not storages to plug in React Native SDK. */ From b0656bc4a8813a240ae0879b90e0883a5493bc70 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 30 Mar 2022 11:43:05 -0300 Subject: [PATCH 07/12] fix vulnerabilities --- package-lock.json | 98 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 20f38ef..58338ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4055,9 +4055,9 @@ }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "astral-regex": { @@ -11812,9 +11812,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mixin-deep": { @@ -11897,10 +11897,37 @@ "dev": true }, "node-fetch": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", - "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==", - "dev": true + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } }, "node-int64": { "version": "0.4.0", @@ -12384,9 +12411,9 @@ } }, "plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "dev": true, "requires": { "base64-js": "^1.5.1", @@ -12717,6 +12744,17 @@ "open": "^6.2.0", "semver": "^6.3.0", "shell-quote": "1.6.1" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + } } }, "@react-native-community/cli-types": { @@ -12795,6 +12833,12 @@ "@sideway/pinpoint": "^2.0.0" } }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -12886,9 +12930,9 @@ } }, "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "ansi-styles": { @@ -13042,6 +13086,28 @@ "has-flag": "^4.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "ws": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", From 1522cd33a8f901e5123a36b36e2aa26547b95efc Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 30 Mar 2022 12:02:04 -0300 Subject: [PATCH 08/12] fixed some typos in type definitions --- types/splitio.d.ts | 75 ++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 6f73f5d..c529351 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Native Split Software SDK v1.0.0 +// Type definitions for React Native Split Software SDK // Project: http://www.split.io/ // Definitions by: Nico Zelaya @@ -9,11 +9,11 @@ export = SplitIO; * EventEmitter interface based on a subset of the NodeJS.EventEmitter methods. */ interface IEventEmitter { - addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: string, listener: (...args: any[]) => void): this on(event: string, listener: (...args: any[]) => void): this once(event: string, listener: (...args: any[]) => void): this - removeListener(event: string, listener: (...args: any[]) => void): this; - off(event: string, listener: (...args: any[]) => void): this; + removeListener(event: string, listener: (...args: any[]) => void): this + off(event: string, listener: (...args: any[]) => void): this removeAllListeners(event?: string): this emit(event: string, ...args: any[]): boolean } @@ -495,7 +495,10 @@ declare namespace SplitIO { * By returning an integration, the SDK will queue events and impressions into it. * Input parameter details are not part of the public API. */ - type IntegrationFactory = (params: {}) => (Integration | void) + type IntegrationFactory = { + readonly type: string + (params: {}): (Integration | void) + } /** * A pair of user key and it's trafficType, required for tracking valid Split events. * @typedef {Object} Identity @@ -732,13 +735,13 @@ declare namespace SplitIO { */ export interface ISDK extends IBasicSDK { /** - * Returns the default client instance of the SDK, associated with the key and optional traffic type from settings. + * Returns the default client instance of the SDK, associated with the key provided on settings. * @function client * @returns {IClient} The client instance. */ client(): IClient, /** - * Returns a shared client of the SDK, associated with the given key and optional traffic type. + * Returns a shared client of the SDK, associated with the given key. * @function client * @param {SplitKey} key The key for the new client instance. * @returns {IClient} The client instance. @@ -759,35 +762,35 @@ declare namespace SplitIO { */ interface IClientSS extends IBasicClient { /** - * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment or treatment promise which will resolve to the treatment string. + * @returns {Treatment} The treatment string. */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value (a map of treatment and config), which will be (or eventually be) the map with treatment and config for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The TreatmentWithConfig or TreatmentWithConfig promise which will resolve to the map containing - * the treatment and the configuration stringified JSON (or null if there was no config for that treatment). + * @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, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * 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. @@ -803,7 +806,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, } @@ -825,7 +828,7 @@ declare namespace SplitIO { */ getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment, /** - * Returns a TreatmentWithConfig value, which will be (or eventually be) a map with both treatment and config string for the given feature. + * 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 @@ -836,17 +839,17 @@ declare namespace SplitIO { */ getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {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. + * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map. */ getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments, /** - * Returns a Treatments value, whick will be (or eventually be) an object with all the maps of treatment and config string for the given features. + * 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. @@ -863,7 +866,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue succesfully or not. + * @returns {Promise} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not. */ track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise } @@ -874,31 +877,31 @@ declare namespace SplitIO { */ interface IClient extends IBasicClient { /** - * Returns a Treatment value, which will be the treatment string for the given feature. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatment} The treatment result. + * @returns {Treatment} The treatment string. */ getTreatment(splitName: string, attributes?: Attributes): Treatment, /** - * Returns a TreatmentWithConfig value, which will be a map of treatment and the config for that treatment. - * @function getTreatment + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {TreatmentWithConfig} The treatment or treatment promise which will resolve to the treatment string. + * @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, /** - * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. - * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object. + * @returns {Treatments} The treatments object map. */ getTreatments(splitNames: string[], attributes?: Attributes): Treatments, /** - * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features. + * 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 {Attributes=} attributes - An object of type Attributes defining the attributes for the given key. @@ -912,7 +915,7 @@ declare namespace SplitIO { * @param {string} eventType - The event type corresponding to this event. * @param {number=} value - The value of this event. * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null. - * @returns {boolean} Whether the event was added to the queue succesfully or not. + * @returns {boolean} Whether the event was added to the queue successfully or not. */ track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean, } @@ -927,20 +930,20 @@ declare namespace SplitIO { * @function names * @returns {SplitNames} The lists of Split names. */ - names(): SplitNames; + names(): SplitNames, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViews} The list of SplitIO.SplitView. */ - splits(): SplitViews; + splits(): SplitViews, /** * 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 {SplitView} The SplitIO.SplitView of the given split. */ - split(splitName: string): SplitView; + split(splitName: string): SplitView, } /** * Representation of a manager instance with asynchronous storage of the SDK. @@ -953,19 +956,19 @@ declare namespace SplitIO { * @function names * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames. */ - names(): SplitNamesAsync; + names(): SplitNamesAsync, /** * Get the array of splits data in SplitView format. * @function splits * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list. */ - splits(): SplitViewsAsync; + 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. */ - split(splitName: string): SplitViewAsync; + split(splitName: string): SplitViewAsync, } } From 4864d3a14033f06ee9b5e918b1853a9b39968508 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 30 Mar 2022 12:14:24 -0300 Subject: [PATCH 09/12] added gha for updating license --- .github/workflows/update-license-year.yml | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/update-license-year.yml diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml new file mode 100644 index 0000000..9e58254 --- /dev/null +++ b/.github/workflows/update-license-year.yml @@ -0,0 +1,45 @@ +name: Update License Year + +on: + schedule: + - cron: "0 3 1 1 *" # 03:00 AM on January 1 + +permissions: + contents: write + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set Current year + run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" + + - name: Set Previous Year + run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" + + - name: Update LICENSE + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: ${{ env.PREVIOUS }} + replace: ${{ env.CURRENT }} + include: "LICENSE" + regex: false + + - name: Commit files + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git commit -m "Updated License Year" -a + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: Update License Year + branch: update-license From f3827b4a5d296225c1c97fba337f53e453d2eb78 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 31 Mar 2022 13:49:56 -0300 Subject: [PATCH 10/12] vulnerability fix --- package-lock.json | 40 ++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58338ce..a8247a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.10", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.10.tgz", - "integrity": "sha512-Ne+0bUkKy1XBd4cI8BObcMP5jr1d+v98JzND0AHUVOuie2U6J9bvuZ+HBUvO7bhu9aSD0etjnip6dyK9CFrkGA==", + "version": "1.2.1-rc.11", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.11.tgz", + "integrity": "sha512-kiba0u5Fnn9O+MBKhM140KnVm7zsY77sIyBrTodOo2EKNHTw8p88eBPnLiR5rRyurQ8AJpMosdrlRphGuQLMYQ==", "requires": { "tslib": "^2.3.1" }, @@ -4583,27 +4583,27 @@ "dev": true }, "big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", "dev": true }, "bplist-creator": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz", - "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz", + "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==", "dev": true, "requires": { - "stream-buffers": "~2.2.0" + "stream-buffers": "2.2.x" } }, "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz", + "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==", "dev": true, "requires": { - "big-integer": "^1.6.44" + "big-integer": "1.6.x" } }, "brace-expansion": { @@ -13905,14 +13905,14 @@ "dev": true }, "simple-plist": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz", - "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", + "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==", "dev": true, "requires": { - "bplist-creator": "0.0.8", - "bplist-parser": "0.2.0", - "plist": "^3.0.1" + "bplist-creator": "0.1.0", + "bplist-parser": "0.3.1", + "plist": "^3.0.5" } }, "sisteransi": { diff --git a/package.json b/package.json index e574f3e..fe81b94 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.10" + "@splitsoftware/splitio-commons": "1.2.1-rc.11" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", From 7190fb15d82e15f6adf141b977cf396e6b5ce006 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 31 Mar 2022 16:30:19 -0300 Subject: [PATCH 11/12] vulnerability fixes in example --- example/package-lock.json | 163 ++++++++++++++++++++++---------------- 1 file changed, 94 insertions(+), 69 deletions(-) diff --git a/example/package-lock.json b/example/package-lock.json index c6744f7..6a6881a 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -1110,9 +1110,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "rimraf": { @@ -1996,9 +1996,9 @@ } }, "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==" }, "ansi-styles": { "version": "4.3.0", @@ -2375,24 +2375,24 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==" + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" }, "bplist-creator": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz", - "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz", + "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==", "requires": { - "stream-buffers": "~2.2.0" + "stream-buffers": "2.2.x" } }, "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz", + "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==", "requires": { - "big-integer": "^1.6.44" + "big-integer": "1.6.x" } }, "brace-expansion": { @@ -2583,9 +2583,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "strip-ansi": { "version": "6.0.0", @@ -3234,9 +3234,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "cross-spawn": { @@ -5684,9 +5684,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "fs-extra": { "version": "1.0.0", @@ -6015,9 +6015,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mixin-deep": { "version": "1.3.2", @@ -6104,9 +6104,33 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } }, "node-int64": { "version": "0.4.0", @@ -6654,13 +6678,12 @@ } }, "plist": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz", - "integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "requires": { "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7", - "xmldom": "^0.5.0" + "xmlbuilder": "^9.0.7" } }, "posix-character-classes": { @@ -6701,9 +6724,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" } } }, @@ -6889,6 +6912,13 @@ "strip-ansi": "^5.2.0", "sudo-prompt": "^9.0.0", "wcwidth": "^1.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + } } }, "chalk": { @@ -7491,9 +7521,9 @@ } }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "requires": { "glob": "^7.0.0", "interpret": "^1.0.0", @@ -7524,13 +7554,13 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "simple-plist": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz", - "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", + "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==", "requires": { - "bplist-creator": "0.0.8", - "bplist-parser": "0.2.0", - "plist": "^3.0.1" + "bplist-creator": "0.1.0", + "bplist-parser": "0.3.1", + "plist": "^3.0.5" } }, "sisteransi": { @@ -7831,9 +7861,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "strip-ansi": { @@ -7858,9 +7888,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -8008,9 +8038,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "astral-regex": { @@ -8111,9 +8141,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==" }, "to-fast-properties": { "version": "2.0.0", @@ -8551,9 +8581,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "strip-ansi": { "version": "6.0.0", @@ -8622,11 +8652,6 @@ "sax": "^1.2.1" } }, - "xmldom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz", - "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==" - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", From ab34018646544584e7c3525796cb4326a63b9596 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 31 Mar 2022 17:28:57 -0300 Subject: [PATCH 12/12] added changelog entry and updated version for stable release --- CHANGES.txt | 7 +++++++ example/ios/Podfile.lock | 4 ++-- package-lock.json | 2 +- package.json | 2 +- src/settings/defaults.ts | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 08f8e05..b7cb516 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,10 @@ +0.2.0 (March 31, 2022) + - Added support for user consent, a way to control if the SDK tracks impressions and events or not, based on users granting or rejecting consent for it. + - Added support to SDK clients to optionally bind attributes, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag. + - Added `scheduler.impressionsQueueSize` property to SDK configuration (See https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#configuration). + - Updated some NPM dependencies for vulnerability fixes. + - Bugfixing - Fixed validation of SDK configuration, to parse core.key into a string and log a warning when passing a number (Related to issue https://github.com/splitio/react-native-client/issues/19). + 0.1.0 (October 20, 2021) - Added localhost mode support (Read more in our docs here: https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#localhost-mode). - Updated @splitsoftware/splitio-commons dependency to version 1.0.0, which includes: diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 884adb6..2b4aa99 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -316,7 +316,7 @@ PODS: - React-cxxreact (= 0.64.1) - React-jsi (= 0.64.1) - React-perflogger (= 0.64.1) - - RNSplit (0.1.0): + - RNSplit (0.2.0): - React - Yoga (1.14.0) - YogaKit (1.18.1): @@ -488,7 +488,7 @@ SPEC CHECKSUMS: React-RCTVibration: 4b99a7f5c6c0abbc5256410cc5425fb8531986e1 React-runtimeexecutor: ff951a0c241bfaefc4940a3f1f1a229e7cb32fa6 ReactCommon: bedc99ed4dae329c4fcf128d0c31b9115e5365ca - RNSplit: e75dc5a74f4c0e34bec2b68a6d075cbd8aadbe48 + RNSplit: c04b293ec271725d77729f8d4703a189bbf5b8a3 Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/package-lock.json b/package-lock.json index a8247a5..0b936d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.1-rc.0", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fe81b94..ee7ee02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.1.1-rc.0", + "version": "0.2.0", "description": "Split SDK for React Native", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 90535be..1419a4a 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -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.1.1-rc.0'; +const packageVersion = '0.2.0'; export const defaults = { startup: {