@splitsoftware/splitio-commons 1.9.2-rc.1 → 1.9.2-rc.2
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/cjs/evaluator/index.js +1 -18
- package/cjs/logger/constants.js +2 -7
- package/cjs/logger/messages/error.js +0 -2
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +1 -4
- package/cjs/sdkClient/client.js +0 -33
- package/cjs/sdkClient/clientAttributesDecoration.js +0 -20
- package/cjs/sdkClient/clientCS.js +4 -5
- package/cjs/sdkClient/clientInputValidation.js +3 -52
- package/cjs/sdkManager/index.js +1 -2
- package/cjs/services/splitApi.js +1 -7
- package/cjs/storages/KeyBuilder.js +0 -3
- package/cjs/storages/KeyBuilderSS.js +0 -4
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
- package/cjs/storages/inLocalStorage/index.js +2 -2
- package/cjs/storages/inMemory/InMemoryStorage.js +2 -2
- package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -3
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -47
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +0 -11
- package/cjs/storages/pluggable/SplitsCachePluggable.js +0 -11
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +4 -24
- package/cjs/sync/submitters/telemetrySubmitter.js +1 -15
- package/cjs/utils/constants/index.js +2 -6
- package/cjs/utils/lang/sets.js +1 -9
- package/cjs/utils/settingsValidation/splitFilters.js +2 -72
- package/esm/evaluator/index.js +0 -16
- package/esm/logger/constants.js +0 -5
- package/esm/logger/messages/error.js +0 -2
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +1 -4
- package/esm/sdkClient/client.js +2 -35
- package/esm/sdkClient/clientAttributesDecoration.js +0 -20
- package/esm/sdkClient/clientCS.js +4 -5
- package/esm/sdkClient/clientInputValidation.js +3 -52
- package/esm/sdkManager/index.js +1 -2
- package/esm/services/splitApi.js +1 -7
- package/esm/storages/KeyBuilder.js +0 -3
- package/esm/storages/KeyBuilderSS.js +0 -4
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
- package/esm/storages/inLocalStorage/index.js +2 -2
- package/esm/storages/inMemory/InMemoryStorage.js +2 -2
- package/esm/storages/inMemory/InMemoryStorageCS.js +3 -3
- package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -47
- package/esm/storages/inRedis/SplitsCacheInRedis.js +0 -11
- package/esm/storages/pluggable/SplitsCachePluggable.js +0 -11
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +4 -24
- package/esm/sync/submitters/telemetrySubmitter.js +1 -15
- package/esm/utils/constants/index.js +0 -4
- package/esm/utils/lang/sets.js +0 -7
- package/esm/utils/settingsValidation/splitFilters.js +2 -71
- package/package.json +1 -1
- package/src/dtos/types.ts +2 -3
- package/src/evaluator/index.ts +0 -24
- package/src/logger/constants.ts +0 -5
- package/src/logger/messages/error.ts +0 -2
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +1 -4
- package/src/sdkClient/client.ts +2 -42
- package/src/sdkClient/clientAttributesDecoration.ts +0 -24
- package/src/sdkClient/clientCS.ts +4 -5
- package/src/sdkClient/clientInputValidation.ts +4 -56
- package/src/sdkManager/index.ts +1 -2
- package/src/services/splitApi.ts +1 -6
- package/src/storages/AbstractSegmentsCacheSync.ts +1 -0
- package/src/storages/AbstractSplitsCacheAsync.ts +0 -2
- package/src/storages/AbstractSplitsCacheSync.ts +0 -3
- package/src/storages/KeyBuilder.ts +0 -4
- package/src/storages/KeyBuilderSS.ts +0 -4
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +28 -74
- package/src/storages/inLocalStorage/index.ts +2 -2
- package/src/storages/inMemory/InMemoryStorage.ts +2 -2
- package/src/storages/inMemory/InMemoryStorageCS.ts +3 -3
- package/src/storages/inMemory/SplitsCacheInMemory.ts +1 -50
- package/src/storages/inRedis/SplitsCacheInRedis.ts +0 -12
- package/src/storages/pluggable/SplitsCachePluggable.ts +0 -12
- package/src/storages/types.ts +3 -7
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +0 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +4 -27
- package/src/sync/submitters/telemetrySubmitter.ts +2 -19
- package/src/sync/submitters/types.ts +1 -7
- package/src/types.ts +1 -118
- package/src/utils/constants/index.ts +0 -4
- package/src/utils/lang/sets.ts +0 -8
- package/src/utils/settingsValidation/splitFilters.ts +2 -77
- package/types/dtos/types.d.ts +0 -1
- package/types/evaluator/index.d.ts +0 -1
- package/types/logger/constants.d.ts +0 -5
- package/types/sdkClient/clientAttributesDecoration.d.ts +0 -4
- package/types/sdkClient/identity.d.ts +6 -0
- package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -0
- package/types/storages/AbstractSplitsCacheAsync.d.ts +0 -2
- package/types/storages/AbstractSplitsCacheSync.d.ts +0 -2
- package/types/storages/KeyBuilder.d.ts +0 -1
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -6
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -9
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +0 -8
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +0 -8
- package/types/storages/types.d.ts +0 -4
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +3 -3
- package/types/sync/submitters/types.d.ts +1 -7
- package/types/types.d.ts +1 -118
- package/types/utils/constants/index.d.ts +0 -4
- package/types/utils/inputValidation/sdkKey.d.ts +7 -0
- package/types/utils/lang/sets.d.ts +0 -1
- package/types/utils/settingsValidation/splitFilters.d.ts +0 -1
- package/types/myLogger.d.ts +0 -5
- package/types/sdkClient/types.d.ts +0 -18
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/storages/metadataBuilder.d.ts +0 -3
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- package/types/sync/offline/updaters/splitChangesUpdater.d.ts +0 -0
- package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
- package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
- package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
- package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
- package/types/sync/syncTaskComposite.d.ts +0 -5
- package/types/trackers/filter/bloomFilter.d.ts +0 -10
- package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
- package/types/trackers/filter/types.d.ts +0 -5
- package/types/utils/timeTracker/index.d.ts +0 -70
- /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
- /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
- /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { STANDALONE_MODE } from '../constants';
|
|
2
2
|
import { validateSplits } from '../inputValidation/splits';
|
|
3
|
-
import { WARN_SPLITS_FILTER_IGNORED, WARN_SPLITS_FILTER_EMPTY, WARN_SPLITS_FILTER_INVALID, SETTINGS_SPLITS_FILTER, LOG_PREFIX_SETTINGS
|
|
4
|
-
import { objectAssign } from '../lang/objectAssign';
|
|
5
|
-
import { find, uniq } from '../lang';
|
|
3
|
+
import { WARN_SPLITS_FILTER_IGNORED, WARN_SPLITS_FILTER_EMPTY, WARN_SPLITS_FILTER_INVALID, SETTINGS_SPLITS_FILTER, LOG_PREFIX_SETTINGS } from '../../logger/constants';
|
|
6
4
|
// Split filters metadata.
|
|
7
5
|
// Ordered according to their precedency when forming the filter query string: `&names=<values>&prefixes=<values>`
|
|
8
6
|
var FILTERS_METADATA = [
|
|
9
|
-
{
|
|
10
|
-
type: 'bySet',
|
|
11
|
-
maxLength: 50,
|
|
12
|
-
queryParam: 'sets='
|
|
13
|
-
},
|
|
14
7
|
{
|
|
15
8
|
type: 'byName',
|
|
16
9
|
maxLength: 400,
|
|
@@ -22,8 +15,6 @@ var FILTERS_METADATA = [
|
|
|
22
15
|
queryParam: 'prefixes='
|
|
23
16
|
}
|
|
24
17
|
];
|
|
25
|
-
var VALID_FLAGSET_REGEX = /^[a-z0-9][_a-z0-9]{0,49}$/;
|
|
26
|
-
var CAPITAL_LETTERS_REGEX = /[A-Z]/;
|
|
27
18
|
/**
|
|
28
19
|
* Validates that the given value is a valid filter type
|
|
29
20
|
*/
|
|
@@ -44,9 +35,6 @@ function validateSplitFilter(log, type, values, maxLength) {
|
|
|
44
35
|
// validate and remove invalid and duplicated values
|
|
45
36
|
var result = validateSplits(log, values, LOG_PREFIX_SETTINGS, type + " filter", type + " filter value");
|
|
46
37
|
if (result) {
|
|
47
|
-
if (type === 'bySet') {
|
|
48
|
-
result = sanitizeFlagSets(log, result);
|
|
49
|
-
}
|
|
50
38
|
// check max length
|
|
51
39
|
if (result.length > maxLength)
|
|
52
40
|
throw new Error(maxLength + " unique values can be specified at most for '" + type + "' filter. You passed " + result.length + ". Please consider reducing the amount or using other filter.");
|
|
@@ -77,42 +65,6 @@ function queryStringBuilder(groupedFilters) {
|
|
|
77
65
|
});
|
|
78
66
|
return queryParams.length > 0 ? '&' + queryParams.join('&') : null;
|
|
79
67
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Sanitizes set names list taking in account:
|
|
82
|
-
* - It should be lowercase
|
|
83
|
-
* - Must adhere the following regular expression /^[a-z0-9][_a-z0-9]{0,49}$/ that means
|
|
84
|
-
* - must start with a letter or number
|
|
85
|
-
* - Be in lowercase
|
|
86
|
-
* - Be alphanumeric
|
|
87
|
-
* - have a max length of 50 characters
|
|
88
|
-
*
|
|
89
|
-
* @param {ILogger} log
|
|
90
|
-
* @param {string[]} flagSets
|
|
91
|
-
* @returns sanitized list of set names
|
|
92
|
-
*/
|
|
93
|
-
function sanitizeFlagSets(log, flagSets) {
|
|
94
|
-
var sanitizedSets = flagSets
|
|
95
|
-
.map(function (flagSet) {
|
|
96
|
-
if (CAPITAL_LETTERS_REGEX.test(flagSet)) {
|
|
97
|
-
log.warn(WARN_SPLITS_FILTER_LOWERCASE_SET, [flagSet]);
|
|
98
|
-
flagSet = flagSet.toLowerCase();
|
|
99
|
-
}
|
|
100
|
-
return flagSet;
|
|
101
|
-
})
|
|
102
|
-
.filter(function (flagSet) {
|
|
103
|
-
if (!VALID_FLAGSET_REGEX.test(flagSet)) {
|
|
104
|
-
log.warn(WARN_SPLITS_FILTER_INVALID_SET, [flagSet, VALID_FLAGSET_REGEX, flagSet]);
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
if (typeof flagSet !== 'string')
|
|
108
|
-
return false;
|
|
109
|
-
return true;
|
|
110
|
-
});
|
|
111
|
-
return uniq(sanitizedSets);
|
|
112
|
-
}
|
|
113
|
-
function configuredFilter(validFilters, filterType) {
|
|
114
|
-
return find(validFilters, function (filter) { return filter.type === filterType && filter.values.length > 0; });
|
|
115
|
-
}
|
|
116
68
|
/**
|
|
117
69
|
* Validates `splitFilters` configuration object and parses it into a query string for filtering splits on `/splitChanges` fetch.
|
|
118
70
|
*
|
|
@@ -131,7 +83,7 @@ export function validateSplitFilters(log, maybeSplitFilters, mode) {
|
|
|
131
83
|
var res = {
|
|
132
84
|
validFilters: [],
|
|
133
85
|
queryString: null,
|
|
134
|
-
groupedFilters: {
|
|
86
|
+
groupedFilters: { byName: [], byPrefix: [] }
|
|
135
87
|
};
|
|
136
88
|
// do nothing if `splitFilters` param is not a non-empty array or mode is not STANDALONE
|
|
137
89
|
if (!maybeSplitFilters)
|
|
@@ -163,29 +115,8 @@ export function validateSplitFilters(log, maybeSplitFilters, mode) {
|
|
|
163
115
|
if (res.groupedFilters[type].length > 0)
|
|
164
116
|
res.groupedFilters[type] = validateSplitFilter(log, type, res.groupedFilters[type], maxLength);
|
|
165
117
|
});
|
|
166
|
-
var setFilter = configuredFilter(res.validFilters, 'bySet');
|
|
167
|
-
// Clean all filters if set filter is present
|
|
168
|
-
if (setFilter) {
|
|
169
|
-
if (configuredFilter(res.validFilters, 'byName') || configuredFilter(res.validFilters, 'byPrefix'))
|
|
170
|
-
log.error(ERROR_SETS_FILTER_EXCLUSIVE);
|
|
171
|
-
objectAssign(res.groupedFilters, { byName: [], byPrefix: [] });
|
|
172
|
-
}
|
|
173
118
|
// build query string
|
|
174
119
|
res.queryString = queryStringBuilder(res.groupedFilters);
|
|
175
120
|
log.debug(SETTINGS_SPLITS_FILTER, [res.queryString]);
|
|
176
121
|
return res;
|
|
177
122
|
}
|
|
178
|
-
export function flagSetsAreValid(log, method, flagSets, flagSetsInConfig) {
|
|
179
|
-
var sets = validateSplits(log, flagSets, method, 'flag sets', 'flag set');
|
|
180
|
-
var toReturn = sets ? sanitizeFlagSets(log, sets) : [];
|
|
181
|
-
if (flagSetsInConfig.length > 0) {
|
|
182
|
-
toReturn = toReturn.filter(function (flagSet) {
|
|
183
|
-
if (flagSetsInConfig.indexOf(flagSet) > -1) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
log.warn(WARN_FLAGSET_NOT_CONFIGURED, [method, flagSet]);
|
|
187
|
-
return false;
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
return toReturn;
|
|
191
|
-
}
|
package/package.json
CHANGED
package/src/dtos/types.ts
CHANGED
|
@@ -163,8 +163,7 @@ export interface ISplit {
|
|
|
163
163
|
trafficAllocationSeed?: number
|
|
164
164
|
configurations?: {
|
|
165
165
|
[treatmentName: string]: string
|
|
166
|
-
}
|
|
167
|
-
sets?: string[]
|
|
166
|
+
}
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
// Split definition used in offline mode
|
|
@@ -209,5 +208,5 @@ export interface IMetadata {
|
|
|
209
208
|
export type ISplitFiltersValidation = {
|
|
210
209
|
queryString: string | null,
|
|
211
210
|
groupedFilters: Record<SplitIO.SplitFilterType, string[]>,
|
|
212
|
-
validFilters: SplitIO.SplitFilter[]
|
|
211
|
+
validFilters: SplitIO.SplitFilter[]
|
|
213
212
|
};
|
package/src/evaluator/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { IStorageAsync, IStorageSync } from '../storages/types';
|
|
|
7
7
|
import { IEvaluationResult } from './types';
|
|
8
8
|
import { SplitIO } from '../types';
|
|
9
9
|
import { ILogger } from '../logger/types';
|
|
10
|
-
import { ISet, setToArray } from '../utils/lang/sets';
|
|
11
10
|
|
|
12
11
|
const treatmentException = {
|
|
13
12
|
treatment: CONTROL,
|
|
@@ -88,29 +87,6 @@ export function evaluateFeatures(
|
|
|
88
87
|
getEvaluations(log, splitNames, parsedSplits, key, attributes, storage);
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
export function evaluateFeaturesByFlagSets(
|
|
92
|
-
log: ILogger,
|
|
93
|
-
key: SplitIO.SplitKey,
|
|
94
|
-
flagSets: string[],
|
|
95
|
-
attributes: SplitIO.Attributes | undefined,
|
|
96
|
-
storage: IStorageSync | IStorageAsync,
|
|
97
|
-
): MaybeThenable<Record<string,IEvaluationResult>> {
|
|
98
|
-
let storedFlagNames: MaybeThenable<ISet<string>>;
|
|
99
|
-
|
|
100
|
-
// get features by flag sets
|
|
101
|
-
try {
|
|
102
|
-
storedFlagNames = storage.splits.getNamesByFlagSets(flagSets);
|
|
103
|
-
} catch (e) {
|
|
104
|
-
// return empty evaluations
|
|
105
|
-
return {};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// evaluate related features
|
|
109
|
-
return thenable(storedFlagNames) ?
|
|
110
|
-
storedFlagNames.then((splitNames) => evaluateFeatures(log, key, setToArray(splitNames), attributes, storage)) :
|
|
111
|
-
evaluateFeatures(log, key, setToArray(storedFlagNames), attributes, storage);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
90
|
function getEvaluation(
|
|
115
91
|
log: ILogger,
|
|
116
92
|
splitJSON: ISplit | null,
|
package/src/logger/constants.ts
CHANGED
|
@@ -97,9 +97,6 @@ export const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
|
97
97
|
export const WARN_SDK_KEY = 222;
|
|
98
98
|
export const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;
|
|
99
99
|
export const STREAMING_PARSING_SPLIT_UPDATE = 224;
|
|
100
|
-
export const WARN_SPLITS_FILTER_INVALID_SET = 225;
|
|
101
|
-
export const WARN_SPLITS_FILTER_LOWERCASE_SET = 226;
|
|
102
|
-
export const WARN_FLAGSET_NOT_CONFIGURED = 227;
|
|
103
100
|
|
|
104
101
|
export const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
|
|
105
102
|
export const ERROR_LOGLEVEL_INVALID = 301;
|
|
@@ -128,8 +125,6 @@ export const ERROR_LOCALHOST_MODULE_REQUIRED = 323;
|
|
|
128
125
|
export const ERROR_STORAGE_INVALID = 324;
|
|
129
126
|
export const ERROR_NOT_BOOLEAN = 325;
|
|
130
127
|
export const ERROR_MIN_CONFIG_PARAM = 326;
|
|
131
|
-
export const ERROR_TOO_MANY_SETS = 327;
|
|
132
|
-
export const ERROR_SETS_FILTER_EXCLUSIVE = 328;
|
|
133
128
|
|
|
134
129
|
// Log prefixes (a.k.a. tags or categories)
|
|
135
130
|
export const LOG_PREFIX_SETTINGS = 'settings';
|
|
@@ -34,6 +34,4 @@ export const codesError: [number, string][] = [
|
|
|
34
34
|
[c.ERROR_LOCALHOST_MODULE_REQUIRED, c.LOG_PREFIX_SETTINGS + ': an invalid value was received for "sync.localhostMode" config. A valid entity should be provided for localhost mode.'],
|
|
35
35
|
[c.ERROR_STORAGE_INVALID, c.LOG_PREFIX_SETTINGS+': the provided storage is invalid.%s Falling back into default MEMORY storage'],
|
|
36
36
|
[c.ERROR_MIN_CONFIG_PARAM, c.LOG_PREFIX_SETTINGS + ': the provided "%s" config param is lower than allowed. Setting to the minimum value %s seconds'],
|
|
37
|
-
[c.ERROR_TOO_MANY_SETS, c.LOG_PREFIX_SETTINGS + ': the amount of flag sets provided are big causing uri length error.'],
|
|
38
|
-
[c.ERROR_SETS_FILTER_EXCLUSIVE, c.LOG_PREFIX_SETTINGS+': the Set filter is exclusive and cannot be used simultaneously with names or prefix filters. Ignoring names and prefixes.'],
|
|
39
37
|
];
|
|
@@ -24,16 +24,13 @@ export const codesWarn: [number, string][] = codesError.concat([
|
|
|
24
24
|
[c.WARN_NOT_EXISTENT_SPLIT, '%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],
|
|
25
25
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
26
26
|
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split user interface.'],
|
|
27
|
-
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: : you passed %s wich is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
28
27
|
// initialization / settings validation
|
|
29
28
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS+': %s integration item(s) at settings is invalid. %s'],
|
|
30
29
|
[c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS+': feature flag filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
|
|
31
|
-
[c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS+': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("
|
|
30
|
+
[c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS+': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("byName" or "byPrefix") and a list of "values".'],
|
|
32
31
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS+': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
33
32
|
[c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS+': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
|
|
34
33
|
|
|
35
34
|
[c.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching MySegments due to an error processing %s notification: %s'],
|
|
36
35
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
|
|
37
|
-
[c.WARN_SPLITS_FILTER_INVALID_SET, c.LOG_PREFIX_SETTINGS+': you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
38
|
-
[c.WARN_SPLITS_FILTER_LOWERCASE_SET, c.LOG_PREFIX_SETTINGS+': flag set %s should be all lowercase - converting string to lowercase.'],
|
|
39
36
|
]);
|
package/src/sdkClient/client.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { evaluateFeature, evaluateFeatures
|
|
1
|
+
import { evaluateFeature, evaluateFeatures } from '../evaluator';
|
|
2
2
|
import { thenable } from '../utils/promise/thenable';
|
|
3
3
|
import { getMatching, getBucketing } from '../utils/key';
|
|
4
4
|
import { validateSplitExistance } from '../utils/inputValidation/splitExistance';
|
|
5
5
|
import { validateTrafficTypeExistance } from '../utils/inputValidation/trafficTypeExistance';
|
|
6
6
|
import { SDK_NOT_READY } from '../utils/labels';
|
|
7
|
-
import { CONTROL, TREATMENT, TREATMENTS, TREATMENT_WITH_CONFIG, TREATMENTS_WITH_CONFIG, TRACK
|
|
7
|
+
import { CONTROL, TREATMENT, TREATMENTS, TREATMENT_WITH_CONFIG, TREATMENTS_WITH_CONFIG, TRACK } from '../utils/constants';
|
|
8
8
|
import { IEvaluationResult } from '../evaluator/types';
|
|
9
9
|
import { SplitIO, ImpressionDTO } from '../types';
|
|
10
10
|
import { IMPRESSION, IMPRESSION_QUEUEING } from '../logger/constants';
|
|
11
11
|
import { ISdkFactoryContext } from '../sdkFactory/types';
|
|
12
12
|
import { isStorageSync } from '../trackers/impressionObserver/utils';
|
|
13
|
-
import { Method } from '../sync/submitters/types';
|
|
14
13
|
|
|
15
14
|
const treatmentNotReady = { treatment: CONTROL, label: SDK_NOT_READY };
|
|
16
15
|
|
|
@@ -82,41 +81,6 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
|
|
|
82
81
|
return getTreatments(key, featureFlagNames, attributes, true);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
function getTreatmentsByFlagSets(key: SplitIO.SplitKey, flagSetNames: string[], attributes: SplitIO.Attributes | undefined, withConfig = false, method: Method = TREATMENTS_BY_FLAGSETS) {
|
|
86
|
-
const stopTelemetryTracker = telemetryTracker.trackEval(method);
|
|
87
|
-
|
|
88
|
-
const wrapUp = (evaluationResults: Record<string,IEvaluationResult>) => {
|
|
89
|
-
const queue: ImpressionDTO[] = [];
|
|
90
|
-
const treatments: Record<string, SplitIO.Treatment | SplitIO.TreatmentWithConfig> = {};
|
|
91
|
-
const evaluations = evaluationResults;
|
|
92
|
-
Object.keys(evaluations).forEach(featureFlagName => {
|
|
93
|
-
treatments[featureFlagName] = processEvaluation(evaluations[featureFlagName], featureFlagName, key, attributes, withConfig, `getTreatmentsByFlagSets${withConfig ? 'WithConfig' : ''}`, queue);
|
|
94
|
-
});
|
|
95
|
-
impressionsTracker.track(queue, attributes);
|
|
96
|
-
|
|
97
|
-
stopTelemetryTracker(queue[0] && queue[0].label);
|
|
98
|
-
return treatments;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const evaluations = readinessManager.isReady() || readinessManager.isReadyFromCache() ?
|
|
102
|
-
evaluateFeaturesByFlagSets(log, key, flagSetNames, attributes, storage) :
|
|
103
|
-
isStorageSync(settings) ? {} : Promise.resolve({}); // Promisify if async
|
|
104
|
-
|
|
105
|
-
return thenable(evaluations) ? evaluations.then((res) => wrapUp(res)) : wrapUp(evaluations);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function getTreatmentsWithConfigByFlagSets(key: SplitIO.SplitKey, flagSetNames: string[], attributes: SplitIO.Attributes | undefined) {
|
|
109
|
-
return getTreatmentsByFlagSets(key, flagSetNames, attributes, true, TREATMENTS_WITH_CONFIG_BY_FLAGSETS);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function getTreatmentsByFlagSet(key: SplitIO.SplitKey, flagSetName: string, attributes: SplitIO.Attributes | undefined) {
|
|
113
|
-
return getTreatmentsByFlagSets(key, [flagSetName], attributes, false, TREATMENTS_BY_FLAGSET);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function getTreatmentsWithConfigByFlagSet(key: SplitIO.SplitKey, flagSetName: string, attributes: SplitIO.Attributes | undefined) {
|
|
117
|
-
return getTreatmentsByFlagSets(key, [flagSetName], attributes, true, TREATMENTS_WITH_CONFIG_BY_FLAGSET);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
84
|
// Internal function
|
|
121
85
|
function processEvaluation(
|
|
122
86
|
evaluation: IEvaluationResult,
|
|
@@ -191,10 +155,6 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
|
|
|
191
155
|
getTreatmentWithConfig,
|
|
192
156
|
getTreatments,
|
|
193
157
|
getTreatmentsWithConfig,
|
|
194
|
-
getTreatmentsByFlagSets,
|
|
195
|
-
getTreatmentsWithConfigByFlagSets,
|
|
196
|
-
getTreatmentsByFlagSet,
|
|
197
|
-
getTreatmentsWithConfigByFlagSet,
|
|
198
158
|
track,
|
|
199
159
|
isClientSide: false
|
|
200
160
|
} as SplitIO.IClient | SplitIO.IAsyncClient;
|
|
@@ -16,10 +16,6 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
|
|
|
16
16
|
const clientGetTreatmentWithConfig = client.getTreatmentWithConfig;
|
|
17
17
|
const clientGetTreatments = client.getTreatments;
|
|
18
18
|
const clientGetTreatmentsWithConfig = client.getTreatmentsWithConfig;
|
|
19
|
-
const clientGetTreatmentsByFlagSets = client.getTreatmentsByFlagSets;
|
|
20
|
-
const clientGetTreatmentsWithConfigByFlagSets = client.getTreatmentsWithConfigByFlagSets;
|
|
21
|
-
const clientGetTreatmentsByFlagSet = client.getTreatmentsByFlagSet;
|
|
22
|
-
const clientGetTreatmentsWithConfigByFlagSet = client.getTreatmentsWithConfigByFlagSet;
|
|
23
19
|
const clientTrack = client.track;
|
|
24
20
|
|
|
25
21
|
function getTreatment(maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes) {
|
|
@@ -38,22 +34,6 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
|
|
|
38
34
|
return clientGetTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
function getTreatmentsByFlagSets(maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes) {
|
|
42
|
-
return clientGetTreatmentsByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getTreatmentsWithConfigByFlagSets(maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes) {
|
|
46
|
-
return clientGetTreatmentsWithConfigByFlagSets(maybeKey, maybeFlagSets, combineAttributes(maybeAttributes));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getTreatmentsByFlagSet(maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes) {
|
|
50
|
-
return clientGetTreatmentsByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getTreatmentsWithConfigByFlagSet(maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes) {
|
|
54
|
-
return clientGetTreatmentsWithConfigByFlagSet(maybeKey, maybeFlagSet, combineAttributes(maybeAttributes));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
37
|
function track(maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number, maybeProperties?: SplitIO.Properties) {
|
|
58
38
|
return clientTrack(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties);
|
|
59
39
|
}
|
|
@@ -71,10 +51,6 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
|
|
|
71
51
|
getTreatmentWithConfig: getTreatmentWithConfig,
|
|
72
52
|
getTreatments: getTreatments,
|
|
73
53
|
getTreatmentsWithConfig: getTreatmentsWithConfig,
|
|
74
|
-
getTreatmentsByFlagSets: getTreatmentsByFlagSets,
|
|
75
|
-
getTreatmentsWithConfigByFlagSets: getTreatmentsWithConfigByFlagSets,
|
|
76
|
-
getTreatmentsByFlagSet: getTreatmentsByFlagSet,
|
|
77
|
-
getTreatmentsWithConfigByFlagSet: getTreatmentsWithConfigByFlagSet,
|
|
78
54
|
track: track,
|
|
79
55
|
|
|
80
56
|
/**
|
|
@@ -21,14 +21,13 @@ export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: Sp
|
|
|
21
21
|
getTreatmentWithConfig: clientCS.getTreatmentWithConfig.bind(clientCS, key),
|
|
22
22
|
getTreatments: clientCS.getTreatments.bind(clientCS, key),
|
|
23
23
|
getTreatmentsWithConfig: clientCS.getTreatmentsWithConfig.bind(clientCS, key),
|
|
24
|
-
getTreatmentsByFlagSets: clientCS.getTreatmentsByFlagSets.bind(clientCS, key),
|
|
25
|
-
getTreatmentsWithConfigByFlagSets: clientCS.getTreatmentsWithConfigByFlagSets.bind(clientCS, key),
|
|
26
|
-
getTreatmentsByFlagSet: clientCS.getTreatmentsByFlagSet.bind(clientCS, key),
|
|
27
|
-
getTreatmentsWithConfigByFlagSet: clientCS.getTreatmentsWithConfigByFlagSet.bind(clientCS, key),
|
|
28
24
|
|
|
29
25
|
// Key is bound to the `track` method. Same thing happens with trafficType but only if provided
|
|
30
26
|
track: trafficType ? clientCS.track.bind(clientCS, key, trafficType) : clientCS.track.bind(clientCS, key),
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
// Not part of the public API. These properties are used to support other modules (e.g., Split Suite)
|
|
29
|
+
isClientSide: true,
|
|
30
|
+
key,
|
|
31
|
+
trafficType
|
|
33
32
|
}) as SplitIO.ICsClient;
|
|
34
33
|
}
|
|
@@ -17,7 +17,6 @@ import { IReadinessManager } from '../readiness/types';
|
|
|
17
17
|
import { MaybeThenable } from '../dtos/types';
|
|
18
18
|
import { ISettings, SplitIO } from '../types';
|
|
19
19
|
import { isStorageSync } from '../trackers/impressionObserver/utils';
|
|
20
|
-
import { flagSetsAreValid } from '../utils/settingsValidation/splitFilters';
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Decorator that validates the input before actually executing the client methods.
|
|
@@ -31,28 +30,21 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
|
|
|
31
30
|
/**
|
|
32
31
|
* Avoid repeating this validations code
|
|
33
32
|
*/
|
|
34
|
-
function validateEvaluationParams(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNameOrNames: string | string[]
|
|
33
|
+
function validateEvaluationParams(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNameOrNames: string | string[], maybeAttributes: SplitIO.Attributes | undefined, methodName: string) {
|
|
35
34
|
const multi = startsWith(methodName, 'getTreatments');
|
|
36
35
|
const key = validateKey(log, maybeKey, methodName);
|
|
37
|
-
|
|
38
|
-
let flagSetOrFlagSets: string[] = [];
|
|
39
|
-
if (maybeFeatureFlagNameOrNames) {
|
|
40
|
-
splitOrSplits = multi ? validateSplits(log, maybeFeatureFlagNameOrNames, methodName) : validateSplit(log, maybeFeatureFlagNameOrNames, methodName);
|
|
41
|
-
}
|
|
36
|
+
const splitOrSplits = multi ? validateSplits(log, maybeFeatureFlagNameOrNames, methodName) : validateSplit(log, maybeFeatureFlagNameOrNames, methodName);
|
|
42
37
|
const attributes = validateAttributes(log, maybeAttributes, methodName);
|
|
43
38
|
const isNotDestroyed = validateIfNotDestroyed(log, readinessManager, methodName);
|
|
44
|
-
|
|
45
|
-
flagSetOrFlagSets = flagSetsAreValid(log, methodName, maybeFlagSetNameOrNames, settings.sync.__splitFiltersValidation.groupedFilters.bySet);
|
|
46
|
-
}
|
|
39
|
+
|
|
47
40
|
validateIfOperational(log, readinessManager, methodName);
|
|
48
41
|
|
|
49
|
-
const valid = isNotDestroyed && key &&
|
|
42
|
+
const valid = isNotDestroyed && key && splitOrSplits && attributes !== false;
|
|
50
43
|
|
|
51
44
|
return {
|
|
52
45
|
valid,
|
|
53
46
|
key,
|
|
54
47
|
splitOrSplits,
|
|
55
|
-
flagSetOrFlagSets,
|
|
56
48
|
attributes
|
|
57
49
|
};
|
|
58
50
|
}
|
|
@@ -107,46 +99,6 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
|
|
|
107
99
|
}
|
|
108
100
|
}
|
|
109
101
|
|
|
110
|
-
function getTreatmentsByFlagSets(maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes) {
|
|
111
|
-
const params = validateEvaluationParams(maybeKey, undefined, maybeAttributes, 'getTreatmentsByFlagSets', maybeFlagSets);
|
|
112
|
-
|
|
113
|
-
if (params.valid) {
|
|
114
|
-
return client.getTreatmentsByFlagSets(params.key as SplitIO.SplitKey, params.flagSetOrFlagSets as string[], params.attributes as SplitIO.Attributes | undefined);
|
|
115
|
-
} else {
|
|
116
|
-
return wrapResult({});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function getTreatmentsWithConfigByFlagSets(maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes) {
|
|
121
|
-
const params = validateEvaluationParams(maybeKey, undefined, maybeAttributes, 'getTreatmentsWithConfigByFlagSets', maybeFlagSets);
|
|
122
|
-
|
|
123
|
-
if (params.valid) {
|
|
124
|
-
return client.getTreatmentsWithConfigByFlagSets(params.key as SplitIO.SplitKey, params.flagSetOrFlagSets as string[], params.attributes as SplitIO.Attributes | undefined);
|
|
125
|
-
} else {
|
|
126
|
-
return wrapResult({});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function getTreatmentsByFlagSet(maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes) {
|
|
131
|
-
const params = validateEvaluationParams(maybeKey, undefined, maybeAttributes, 'getTreatmentsByFlagSet', [maybeFlagSet]);
|
|
132
|
-
|
|
133
|
-
if (params.valid) {
|
|
134
|
-
return client.getTreatmentsByFlagSet(params.key as SplitIO.SplitKey, params.flagSetOrFlagSets[0] as string, params.attributes as SplitIO.Attributes | undefined);
|
|
135
|
-
} else {
|
|
136
|
-
return wrapResult({});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function getTreatmentsWithConfigByFlagSet(maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes) {
|
|
141
|
-
const params = validateEvaluationParams(maybeKey, undefined, maybeAttributes, 'getTreatmentsWithConfigByFlagSet', [maybeFlagSet]);
|
|
142
|
-
|
|
143
|
-
if (params.valid) {
|
|
144
|
-
return client.getTreatmentsWithConfigByFlagSet(params.key as SplitIO.SplitKey, params.flagSetOrFlagSets[0] as string, params.attributes as SplitIO.Attributes | undefined);
|
|
145
|
-
} else {
|
|
146
|
-
return wrapResult({});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
102
|
function track(maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number, maybeProperties?: SplitIO.Properties) {
|
|
151
103
|
const key = validateKey(log, maybeKey, 'track');
|
|
152
104
|
const tt = validateTrafficType(log, maybeTT, 'track');
|
|
@@ -167,10 +119,6 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
|
|
|
167
119
|
getTreatmentWithConfig,
|
|
168
120
|
getTreatments,
|
|
169
121
|
getTreatmentsWithConfig,
|
|
170
|
-
getTreatmentsByFlagSets,
|
|
171
|
-
getTreatmentsWithConfigByFlagSets,
|
|
172
|
-
getTreatmentsByFlagSet,
|
|
173
|
-
getTreatmentsWithConfigByFlagSet,
|
|
174
122
|
track
|
|
175
123
|
} as TClient;
|
|
176
124
|
}
|
package/src/sdkManager/index.ts
CHANGED
|
@@ -31,8 +31,7 @@ function objectToView(splitObject: ISplit | null): SplitIO.SplitView | null {
|
|
|
31
31
|
killed: splitObject.killed,
|
|
32
32
|
changeNumber: splitObject.changeNumber || 0,
|
|
33
33
|
treatments: collectTreatments(splitObject),
|
|
34
|
-
configs: splitObject.configurations || {}
|
|
35
|
-
sets: splitObject.sets || []
|
|
34
|
+
configs: splitObject.configurations || {}
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
|
package/src/services/splitApi.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { ISplitApi } from './types';
|
|
|
5
5
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
6
6
|
import { ITelemetryTracker } from '../trackers/types';
|
|
7
7
|
import { SPLITS, IMPRESSIONS, IMPRESSIONS_COUNT, EVENTS, TELEMETRY, TOKEN, SEGMENT, MY_SEGMENT } from '../utils/constants';
|
|
8
|
-
import { ERROR_TOO_MANY_SETS } from '../logger/constants';
|
|
9
8
|
|
|
10
9
|
const noCacheHeaderOptions = { headers: { 'Cache-Control': 'no-cache' } };
|
|
11
10
|
|
|
@@ -54,11 +53,7 @@ export function splitApiFactory(
|
|
|
54
53
|
|
|
55
54
|
fetchSplitChanges(since: number, noCache?: boolean, till?: number) {
|
|
56
55
|
const url = `${urls.sdk}/splitChanges?since=${since}${till ? '&till=' + till : ''}${filterQueryString || ''}`;
|
|
57
|
-
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS))
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
if (err.statusCode === 414) settings.log.error(ERROR_TOO_MANY_SETS);
|
|
60
|
-
throw err;
|
|
61
|
-
});
|
|
56
|
+
return splitHttpClient(url, noCache ? noCacheHeaderOptions : undefined, telemetryTracker.trackHttp(SPLITS));
|
|
62
57
|
},
|
|
63
58
|
|
|
64
59
|
fetchSegmentChanges(since: number, segmentName: string, noCache?: boolean, till?: number) {
|
|
@@ -44,6 +44,7 @@ export abstract class AbstractSegmentsCacheSync implements ISegmentsCacheSync {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
|
|
47
|
+
* @TODO for client-side it should be the number of clients, but it requires a refactor of MySegments caches to simplify the code.
|
|
47
48
|
*/
|
|
48
49
|
abstract getKeysCount(): number
|
|
49
50
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ISplitsCacheAsync } from './types';
|
|
2
2
|
import { ISplit } from '../dtos/types';
|
|
3
3
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
4
|
-
import { ISet } from '../utils/lang/sets';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
@@ -18,7 +17,6 @@ export abstract class AbstractSplitsCacheAsync implements ISplitsCacheAsync {
|
|
|
18
17
|
abstract getChangeNumber(): Promise<number>
|
|
19
18
|
abstract getAll(): Promise<ISplit[]>
|
|
20
19
|
abstract getSplitNames(): Promise<string[]>
|
|
21
|
-
abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>
|
|
22
20
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>
|
|
23
21
|
abstract clear(): Promise<boolean | void>
|
|
24
22
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ISplitsCacheSync } from './types';
|
|
2
2
|
import { ISplit } from '../dtos/types';
|
|
3
3
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
4
|
-
import { ISet } from '../utils/lang/sets';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* This class provides a skeletal implementation of the ISplitsCacheSync interface
|
|
@@ -79,8 +78,6 @@ export abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
|
|
|
79
78
|
return false;
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
abstract getNamesByFlagSets(flagSets: string[]): ISet<string>
|
|
83
|
-
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
/**
|
|
@@ -20,10 +20,6 @@ export class KeyBuilder {
|
|
|
20
20
|
return `${this.prefix}.trafficType.${trafficType}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
buildFlagSetKey(flagSet: string) {
|
|
24
|
-
return `${this.prefix}.flagset.${flagSet}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
buildSplitKey(splitName: string) {
|
|
28
24
|
return `${this.prefix}.split.${splitName}`;
|
|
29
25
|
}
|
|
@@ -7,10 +7,6 @@ export const METHOD_NAMES: Record<Method, string> = {
|
|
|
7
7
|
ts: 'treatments',
|
|
8
8
|
tc: 'treatmentWithConfig',
|
|
9
9
|
tcs: 'treatmentsWithConfig',
|
|
10
|
-
tf: 'treatmentsByFlagSet',
|
|
11
|
-
tfs: 'treatmentsByFlagSets',
|
|
12
|
-
tcf: 'treatmentsWithConfigByFlagSet',
|
|
13
|
-
tcfs: 'treatmentsWithConfigByFlagSets',
|
|
14
10
|
tr: 'track'
|
|
15
11
|
};
|
|
16
12
|
|