@splitsoftware/splitio-commons 1.12.1-rc.4 → 1.12.1-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +1 -1
- package/cjs/logger/constants.js +3 -3
- package/cjs/logger/messages/warn.js +2 -2
- package/cjs/sdkClient/client.js +11 -8
- package/cjs/sdkClient/clientInputValidation.js +6 -6
- package/cjs/sdkManager/index.js +6 -6
- package/cjs/storages/KeyBuilder.js +13 -1
- package/cjs/storages/KeyBuilderCS.js +1 -4
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +12 -16
- package/cjs/storages/inLocalStorage/index.js +1 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +2 -2
- package/cjs/storages/inRedis/index.js +1 -1
- package/cjs/storages/pluggable/SplitsCachePluggable.js +2 -2
- package/cjs/storages/pluggable/index.js +14 -3
- package/cjs/trackers/eventTracker.js +4 -4
- package/cjs/utils/lang/sets.js +3 -3
- package/cjs/utils/settingsValidation/index.js +1 -1
- package/cjs/utils/settingsValidation/mode.js +10 -3
- package/cjs/utils/settingsValidation/splitFilters.js +20 -19
- package/esm/logger/constants.js +2 -2
- package/esm/logger/messages/warn.js +2 -2
- package/esm/sdkClient/client.js +11 -8
- package/esm/sdkClient/clientInputValidation.js +7 -7
- package/esm/sdkManager/index.js +6 -6
- package/esm/storages/KeyBuilder.js +11 -0
- package/esm/storages/KeyBuilderCS.js +1 -4
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +12 -16
- package/esm/storages/inLocalStorage/index.js +1 -1
- package/esm/storages/inRedis/SplitsCacheInRedis.js +3 -3
- package/esm/storages/inRedis/index.js +1 -1
- package/esm/storages/pluggable/SplitsCachePluggable.js +3 -3
- package/esm/storages/pluggable/index.js +15 -4
- package/esm/trackers/eventTracker.js +4 -4
- package/esm/utils/lang/sets.js +1 -1
- package/esm/utils/settingsValidation/index.js +2 -2
- package/esm/utils/settingsValidation/mode.js +7 -1
- package/esm/utils/settingsValidation/splitFilters.js +11 -10
- package/package.json +1 -1
- package/src/logger/constants.ts +2 -2
- package/src/logger/messages/warn.ts +2 -2
- package/src/sdkClient/client.ts +11 -8
- package/src/sdkClient/clientInputValidation.ts +7 -7
- package/src/sdkManager/index.ts +6 -6
- package/src/storages/KeyBuilder.ts +14 -1
- package/src/storages/KeyBuilderCS.ts +1 -5
- package/src/storages/KeyBuilderSS.ts +4 -4
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +16 -14
- package/src/storages/inLocalStorage/index.ts +1 -1
- package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
- package/src/storages/inRedis/index.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
- package/src/storages/pluggable/index.ts +15 -5
- package/src/storages/types.ts +3 -3
- package/src/trackers/eventTracker.ts +4 -4
- package/src/utils/lang/sets.ts +1 -1
- package/src/utils/murmur3/murmur3.ts +0 -1
- package/src/utils/settingsValidation/index.ts +2 -2
- package/src/utils/settingsValidation/mode.ts +8 -1
- package/src/utils/settingsValidation/splitFilters.ts +11 -10
- package/types/logger/constants.d.ts +2 -2
- package/types/storages/AbstractSplitsCache.d.ts +46 -0
- package/types/storages/KeyBuilder.d.ts +8 -1
- package/types/storages/KeyBuilderCS.d.ts +0 -1
- package/types/storages/KeyBuilderSS.d.ts +4 -4
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +5 -5
- package/types/utils/lang/sets.d.ts +1 -1
- package/types/utils/settingsValidation/mode.d.ts +5 -1
- package/types/utils/settingsValidation/splitFilters.d.ts +1 -1
- package/cjs/trackers/impressionObserver/utils.js +0 -11
- package/cjs/utils/redis/RedisMock.js +0 -31
- package/esm/trackers/impressionObserver/utils.js +0 -7
- package/esm/utils/redis/RedisMock.js +0 -28
- package/src/trackers/impressionObserver/utils.ts +0 -9
- package/src/utils/redis/RedisMock.ts +0 -31
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ISplit
|
|
1
|
+
import { ISplit } from '../../dtos/types';
|
|
2
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
3
|
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
|
-
import { ILogger } from '../../logger/types';
|
|
5
4
|
import { ISet } from '../../utils/lang/sets';
|
|
5
|
+
import { ISettings } from '../../types';
|
|
6
6
|
/**
|
|
7
7
|
* ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
|
|
8
8
|
*/
|
|
9
9
|
export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
10
|
-
private readonly log;
|
|
11
10
|
private readonly keys;
|
|
12
|
-
private readonly
|
|
11
|
+
private readonly log;
|
|
12
|
+
private readonly storageHash;
|
|
13
13
|
private readonly flagSetsFilter;
|
|
14
14
|
private hasSync?;
|
|
15
15
|
private updateNewFilter?;
|
|
@@ -18,7 +18,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
18
18
|
* @param {number | undefined} expirationTimestamp
|
|
19
19
|
* @param {ISplitFiltersValidation} splitFiltersValidation
|
|
20
20
|
*/
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(settings: ISettings, keys: KeyBuilderCS, expirationTimestamp?: number);
|
|
22
22
|
private _decrementCount;
|
|
23
23
|
private _decrementCounts;
|
|
24
24
|
private _incrementCounts;
|
|
@@ -58,5 +58,5 @@ interface ISetConstructor {
|
|
|
58
58
|
export declare function __getSetConstructor(): ISetConstructor;
|
|
59
59
|
export declare const _Set: ISetConstructor;
|
|
60
60
|
export declare function returnSetsUnion<T>(set: ISet<T>, set2: ISet<T>): ISet<T>;
|
|
61
|
-
export declare function
|
|
61
|
+
export declare function returnDifference<T>(list?: T[], list2?: T[]): T[];
|
|
62
62
|
export {};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function validateMode(key: string, mode: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Storage is async if mode is consumer or partial consumer
|
|
4
|
+
*/
|
|
5
|
+
export declare function isConsumerMode(mode: string): boolean;
|
|
@@ -14,4 +14,4 @@ import { ILogger } from '../../logger/types';
|
|
|
14
14
|
* @throws Error if the some of the grouped list of values per filter exceeds the max allowed length
|
|
15
15
|
*/
|
|
16
16
|
export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any, mode: string): ISplitFiltersValidation;
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function validateFlagSets(log: ILogger, method: string, flagSets: string[], flagSetsInConfig: string[]): string[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStorageSync = void 0;
|
|
4
|
-
var constants_1 = require("../../utils/constants");
|
|
5
|
-
/**
|
|
6
|
-
* Storage is async if mode is consumer or partial consumer
|
|
7
|
-
*/
|
|
8
|
-
function isStorageSync(settings) {
|
|
9
|
-
return [constants_1.CONSUMER_MODE, constants_1.CONSUMER_PARTIAL_MODE].indexOf(settings.mode) === -1 ? true : false;
|
|
10
|
-
}
|
|
11
|
-
exports.isStorageSync = isStorageSync;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedisMock = void 0;
|
|
4
|
-
//@ts-nocheck
|
|
5
|
-
function identityFunction(data) {
|
|
6
|
-
return data;
|
|
7
|
-
}
|
|
8
|
-
function asyncFunction(data) {
|
|
9
|
-
return Promise.resolve(data);
|
|
10
|
-
}
|
|
11
|
-
var IDENTITY_METHODS = [];
|
|
12
|
-
var ASYNC_METHODS = ['rpush', 'hincrby'];
|
|
13
|
-
var PIPELINE_METHODS = ['rpush', 'hincrby'];
|
|
14
|
-
var RedisMock = /** @class */ (function () {
|
|
15
|
-
function RedisMock() {
|
|
16
|
-
var _this = this;
|
|
17
|
-
this.pipelineMethods = { exec: jest.fn(asyncFunction) };
|
|
18
|
-
IDENTITY_METHODS.forEach(function (method) {
|
|
19
|
-
_this[method] = jest.fn(identityFunction);
|
|
20
|
-
});
|
|
21
|
-
ASYNC_METHODS.forEach(function (method) {
|
|
22
|
-
_this[method] = jest.fn(asyncFunction);
|
|
23
|
-
});
|
|
24
|
-
PIPELINE_METHODS.forEach(function (method) {
|
|
25
|
-
_this.pipelineMethods[method] = _this[method];
|
|
26
|
-
});
|
|
27
|
-
this.pipeline = jest.fn(function () { return _this.pipelineMethods; });
|
|
28
|
-
}
|
|
29
|
-
return RedisMock;
|
|
30
|
-
}());
|
|
31
|
-
exports.RedisMock = RedisMock;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE } from '../../utils/constants';
|
|
2
|
-
/**
|
|
3
|
-
* Storage is async if mode is consumer or partial consumer
|
|
4
|
-
*/
|
|
5
|
-
export function isStorageSync(settings) {
|
|
6
|
-
return [CONSUMER_MODE, CONSUMER_PARTIAL_MODE].indexOf(settings.mode) === -1 ? true : false;
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
function identityFunction(data) {
|
|
3
|
-
return data;
|
|
4
|
-
}
|
|
5
|
-
function asyncFunction(data) {
|
|
6
|
-
return Promise.resolve(data);
|
|
7
|
-
}
|
|
8
|
-
var IDENTITY_METHODS = [];
|
|
9
|
-
var ASYNC_METHODS = ['rpush', 'hincrby'];
|
|
10
|
-
var PIPELINE_METHODS = ['rpush', 'hincrby'];
|
|
11
|
-
var RedisMock = /** @class */ (function () {
|
|
12
|
-
function RedisMock() {
|
|
13
|
-
var _this = this;
|
|
14
|
-
this.pipelineMethods = { exec: jest.fn(asyncFunction) };
|
|
15
|
-
IDENTITY_METHODS.forEach(function (method) {
|
|
16
|
-
_this[method] = jest.fn(identityFunction);
|
|
17
|
-
});
|
|
18
|
-
ASYNC_METHODS.forEach(function (method) {
|
|
19
|
-
_this[method] = jest.fn(asyncFunction);
|
|
20
|
-
});
|
|
21
|
-
PIPELINE_METHODS.forEach(function (method) {
|
|
22
|
-
_this.pipelineMethods[method] = _this[method];
|
|
23
|
-
});
|
|
24
|
-
this.pipeline = jest.fn(function () { return _this.pipelineMethods; });
|
|
25
|
-
}
|
|
26
|
-
return RedisMock;
|
|
27
|
-
}());
|
|
28
|
-
export { RedisMock };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE } from '../../utils/constants';
|
|
2
|
-
import { ISettings } from '../../types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Storage is async if mode is consumer or partial consumer
|
|
6
|
-
*/
|
|
7
|
-
export function isStorageSync(settings: Pick<ISettings, 'mode'>) {
|
|
8
|
-
return [CONSUMER_MODE, CONSUMER_PARTIAL_MODE].indexOf(settings.mode) === -1 ? true : false;
|
|
9
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
function identityFunction(data: any): any {
|
|
3
|
-
return data;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function asyncFunction(data: any): Promise<any> {
|
|
7
|
-
return Promise.resolve(data);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const IDENTITY_METHODS: string[] = [];
|
|
11
|
-
const ASYNC_METHODS = ['rpush', 'hincrby'];
|
|
12
|
-
const PIPELINE_METHODS = ['rpush', 'hincrby'];
|
|
13
|
-
|
|
14
|
-
export class RedisMock {
|
|
15
|
-
|
|
16
|
-
private pipelineMethods: any = { exec: jest.fn(asyncFunction) };
|
|
17
|
-
|
|
18
|
-
constructor() {
|
|
19
|
-
IDENTITY_METHODS.forEach(method => {
|
|
20
|
-
this[method] = jest.fn(identityFunction);
|
|
21
|
-
});
|
|
22
|
-
ASYNC_METHODS.forEach(method => {
|
|
23
|
-
this[method] = jest.fn(asyncFunction);
|
|
24
|
-
});
|
|
25
|
-
PIPELINE_METHODS.forEach(method => {
|
|
26
|
-
this.pipelineMethods[method] = this[method];
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
this.pipeline = jest.fn(() => { return this.pipelineMethods; });
|
|
30
|
-
}
|
|
31
|
-
}
|