Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release v0.6.0 #75

Merged
merged 10 commits into from
May 13, 2024
7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.6.0 (May 13, 2024)
- Added a new configuration option `sync.flagSpecVersion` to specify the flags spec version of feature flag definitions to be fetched and stored.
- Updated @splitsoftware/splitio-commons package to version 1.15.0 that includes minor updates:
- Added support for targeting rules based on semantic versions (https://semver.org/).
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
- Updated some transitive dependencies for vulnerability fixes.

0.5.1 (February 29, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.13.1 and some transitive dependencies for vulnerability fixes.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ Split has built and maintains SDKs for:
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
* Flutter [Github](https://github.com/splitio/flutter-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin)
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
* 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)
* 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)
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-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)
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
Expand Down
155 changes: 56 additions & 99 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-sync-tools",
"version": "0.5.1",
"version": "0.6.0",
"description": "Split JavaScript Sync Tools",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
Expand Down Expand Up @@ -51,7 +51,7 @@
"prepublishOnly": "npm run check && npm run test && npm run build"
},
"dependencies": {
"@splitsoftware/splitio-commons": "1.13.1",
"@splitsoftware/splitio-commons": "1.15.0",
"dotenv": "^9.0.1",
"node-fetch": "^2.6.7",
"yargs": "^17.0.1"
Expand Down
13 changes: 10 additions & 3 deletions src/settings/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { synchronizerSettingsValidator } from '../index';
import { defaults } from '../defaults';
import { ISynchronizerSettings } from '../../../types';

describe('synchronizerSettingsValidator', () => {

test('should return default values when no param or invalid param is provided', () => {
const config = {
const config: ISynchronizerSettings = {
core: {
authorizationKey: 'fake-key',
},
Expand All @@ -13,12 +14,18 @@ describe('synchronizerSettingsValidator', () => {
impressionsPerPost: -1, // invalid, must be a positive integer
maxRetries: 10, // overwriting default value
},
}; // @ts-ignore
sync: {
// @ts-expect-error
flagSpecVersion: 'invalid',
},
storage: { wrapper: {} },
};
const settings = synchronizerSettingsValidator(config);

expect(settings.scheduler.eventsPerPost).toBe(defaults.scheduler.eventsPerPost);
expect(settings.scheduler.impressionsPerPost).toBe(defaults.scheduler.impressionsPerPost);
expect(settings.scheduler.maxRetries).toBe(config.scheduler.maxRetries);
expect(settings.scheduler.maxRetries).toBe(config.scheduler!.maxRetries);
expect(settings.sync.flagSpecVersion).toBe('1.1');
});

});
9 changes: 9 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ILogger } from '@splitsoftware/splitio-commons/src/logger/types';
import { ISettings } from '@splitsoftware/splitio-commons/src/types';
import { FLAG_SPEC_VERSION } from '@splitsoftware/splitio-commons/src/utils/constants';
import { isIntegerNumber } from '@splitsoftware/splitio-commons/src/utils/lang';
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index';
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
import { ISynchronizerSettings } from '../../types';
import { defaults } from './defaults';

const FLAG_SPEC_VERSIONS = ['1.0', FLAG_SPEC_VERSION];

/**
* Object with some default values to instantiate the application and fullfil internal
* requirements.
Expand All @@ -15,6 +18,12 @@ const params = {
defaults,
consent: () => undefined,
runtime: () => { return { ip: false, hostname: false }; },
flagSpec: ({ sync: { flagSpecVersion }, log }: ISettings) => {
if (FLAG_SPEC_VERSIONS.indexOf(flagSpecVersion) > -1) return flagSpecVersion;

log.error(`settings: you passed an invalid "flagSpecVersion" config param. It should be one of the following values: ${FLAG_SPEC_VERSIONS.map((version => `"${version}"`))}. Defaulting to "${FLAG_SPEC_VERSION}"`);
return FLAG_SPEC_VERSION;
},
};

function validatePositiveInteger(log: ILogger, paramName: string, actualValue: any, defaultValue: number) {
Expand Down
7 changes: 7 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ declare module JsSyncTools {
* @property {SplitFilter[]} splitFilters
*/
splitFilters?: SplitFilter[]
/**
* Feature Flag Spec version. Option to determine which version of the feature flag definitions are fetched and stored.
* Possible values are '1.0' and '1.1'.
*
* @default '1.1'
*/
flagSpecVersion?: '1.0' | '1.1'
/**
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers.
*
Expand Down
Loading