Skip to content

Commit 7f31beb

Browse files
Merge pull request #483 from splitio/sdk-configs-rename-split-to-definition
[SDK Configs] Rename `split` to `definition` to generalize the concept for Configs support
2 parents e86fe01 + 28c6273 commit 7f31beb

76 files changed

Lines changed: 675 additions & 662 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/dtos/types.ts

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import SplitIO from '../../types/splitio';
22

33
export type MaybeThenable<T> = T | Promise<T>
44

5-
/** Split Matchers */
6-
75
export type IMatcherDataType = null | 'DATETIME' | 'NUMBER'
86

97
export interface IUnaryNumericMatcherData {
@@ -39,7 +37,7 @@ export interface IDependencyMatcherData {
3937
treatments: string[]
4038
}
4139

42-
interface ISplitMatcherBase {
40+
interface IDefinitionMatcherBase {
4341
matcherType: string
4442
negate?: boolean
4543
keySelector?: null | {
@@ -57,144 +55,143 @@ interface ISplitMatcherBase {
5755
betweenStringMatcherData?: null | IBetweenStringMatcherData
5856
}
5957

60-
interface IAllKeysMatcher extends ISplitMatcherBase {
58+
interface IAllKeysMatcher extends IDefinitionMatcherBase {
6159
matcherType: 'ALL_KEYS'
6260
}
6361

64-
interface IInSegmentMatcher extends ISplitMatcherBase {
62+
interface IInSegmentMatcher extends IDefinitionMatcherBase {
6563
matcherType: 'IN_SEGMENT',
6664
userDefinedSegmentMatcherData: IInSegmentMatcherData
6765
}
6866

69-
interface IInRBSegmentMatcher extends ISplitMatcherBase {
67+
interface IInRBSegmentMatcher extends IDefinitionMatcherBase {
7068
matcherType: 'IN_RULE_BASED_SEGMENT',
7169
userDefinedSegmentMatcherData: IInSegmentMatcherData
7270
}
7371

74-
interface IInLargeSegmentMatcher extends ISplitMatcherBase {
72+
interface IInLargeSegmentMatcher extends IDefinitionMatcherBase {
7573
matcherType: 'IN_LARGE_SEGMENT',
7674
userDefinedLargeSegmentMatcherData: IInLargeSegmentMatcherData
7775
}
7876

79-
interface IWhitelistMatcher extends ISplitMatcherBase {
77+
interface IWhitelistMatcher extends IDefinitionMatcherBase {
8078
matcherType: 'WHITELIST',
8179
whitelistMatcherData: IWhitelistMatcherData
8280
}
8381

84-
interface IEqualToMatcher extends ISplitMatcherBase {
82+
interface IEqualToMatcher extends IDefinitionMatcherBase {
8583
matcherType: 'EQUAL_TO',
8684
unaryNumericMatcherData: IUnaryNumericMatcherData
8785
}
8886

89-
interface IGreaterThanOrEqualToMatcher extends ISplitMatcherBase {
87+
interface IGreaterThanOrEqualToMatcher extends IDefinitionMatcherBase {
9088
matcherType: 'GREATER_THAN_OR_EQUAL_TO',
9189
unaryNumericMatcherData: IUnaryNumericMatcherData
9290
}
9391

94-
interface ILessThanOrEqualToMatcher extends ISplitMatcherBase {
92+
interface ILessThanOrEqualToMatcher extends IDefinitionMatcherBase {
9593
matcherType: 'LESS_THAN_OR_EQUAL_TO',
9694
unaryNumericMatcherData: IUnaryNumericMatcherData
9795
}
9896

99-
interface IBetweenMatcher extends ISplitMatcherBase {
97+
interface IBetweenMatcher extends IDefinitionMatcherBase {
10098
matcherType: 'BETWEEN'
10199
betweenMatcherData: IBetweenMatcherData
102100
}
103101

104-
interface IEqualToSetMatcher extends ISplitMatcherBase {
102+
interface IEqualToSetMatcher extends IDefinitionMatcherBase {
105103
matcherType: 'EQUAL_TO_SET',
106104
whitelistMatcherData: IWhitelistMatcherData
107105
}
108106

109-
interface IContainsAnyOfSetMatcher extends ISplitMatcherBase {
107+
interface IContainsAnyOfSetMatcher extends IDefinitionMatcherBase {
110108
matcherType: 'CONTAINS_ANY_OF_SET',
111109
whitelistMatcherData: IWhitelistMatcherData
112110
}
113111

114-
interface IContainsAllOfSetMatcher extends ISplitMatcherBase {
112+
interface IContainsAllOfSetMatcher extends IDefinitionMatcherBase {
115113
matcherType: 'CONTAINS_ALL_OF_SET',
116114
whitelistMatcherData: IWhitelistMatcherData
117115
}
118116

119-
interface IPartOfSetMatcher extends ISplitMatcherBase {
117+
interface IPartOfSetMatcher extends IDefinitionMatcherBase {
120118
matcherType: 'PART_OF_SET',
121119
whitelistMatcherData: IWhitelistMatcherData
122120
}
123121

124-
interface IStartsWithMatcher extends ISplitMatcherBase {
122+
interface IStartsWithMatcher extends IDefinitionMatcherBase {
125123
matcherType: 'STARTS_WITH',
126124
whitelistMatcherData: IWhitelistMatcherData
127125
}
128126

129-
interface IEndsWithMatcher extends ISplitMatcherBase {
127+
interface IEndsWithMatcher extends IDefinitionMatcherBase {
130128
matcherType: 'ENDS_WITH',
131129
whitelistMatcherData: IWhitelistMatcherData
132130
}
133131

134-
interface IContainsStringMatcher extends ISplitMatcherBase {
132+
interface IContainsStringMatcher extends IDefinitionMatcherBase {
135133
matcherType: 'CONTAINS_STRING',
136134
whitelistMatcherData: IWhitelistMatcherData
137135
}
138136

139-
interface IInSplitTreatmentMatcher extends ISplitMatcherBase {
137+
interface IInSplitTreatmentMatcher extends IDefinitionMatcherBase {
140138
matcherType: 'IN_SPLIT_TREATMENT',
141139
dependencyMatcherData: IDependencyMatcherData,
142140
}
143141

144-
interface IEqualToBooleanMatcher extends ISplitMatcherBase {
142+
interface IEqualToBooleanMatcher extends IDefinitionMatcherBase {
145143
matcherType: 'EQUAL_TO_BOOLEAN',
146144
booleanMatcherData: boolean
147145
}
148146

149-
interface IMatchesStringMatcher extends ISplitMatcherBase {
147+
interface IMatchesStringMatcher extends IDefinitionMatcherBase {
150148
matcherType: 'MATCHES_STRING',
151149
stringMatcherData: string
152150
}
153151

154-
interface IEqualToSemverMatcher extends ISplitMatcherBase {
152+
interface IEqualToSemverMatcher extends IDefinitionMatcherBase {
155153
matcherType: 'EQUAL_TO_SEMVER',
156154
stringMatcherData: string
157155
}
158156

159-
interface IGreaterThanOrEqualToSemverMatcher extends ISplitMatcherBase {
157+
interface IGreaterThanOrEqualToSemverMatcher extends IDefinitionMatcherBase {
160158
matcherType: 'GREATER_THAN_OR_EQUAL_TO_SEMVER',
161159
stringMatcherData: string
162160
}
163161

164162

165-
interface ILessThanOrEqualToSemverMatcher extends ISplitMatcherBase {
163+
interface ILessThanOrEqualToSemverMatcher extends IDefinitionMatcherBase {
166164
matcherType: 'LESS_THAN_OR_EQUAL_TO_SEMVER',
167165
stringMatcherData: string
168166
}
169167

170-
interface IBetweenSemverMatcher extends ISplitMatcherBase {
168+
interface IBetweenSemverMatcher extends IDefinitionMatcherBase {
171169
matcherType: 'BETWEEN_SEMVER'
172170
betweenStringMatcherData: IBetweenStringMatcherData
173171
}
174172

175-
interface IInListSemverMatcher extends ISplitMatcherBase {
173+
interface IInListSemverMatcher extends IDefinitionMatcherBase {
176174
matcherType: 'IN_LIST_SEMVER',
177175
whitelistMatcherData: IWhitelistMatcherData
178176
}
179177

180-
export type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher |
178+
export type IDefinitionMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher |
181179
ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher |
182180
IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher |
183181
IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher |
184182
IInLargeSegmentMatcher | IInRBSegmentMatcher
185183

186-
/** Split object */
187-
export interface ISplitPartition {
184+
export interface IDefinitionPartition {
188185
treatment: string
189186
size: number
190187
}
191188

192-
export interface ISplitCondition {
189+
export interface IDefinitionCondition {
193190
matcherGroup: {
194191
combiner: 'AND',
195-
matchers: ISplitMatcher[]
192+
matchers: IDefinitionMatcher[]
196193
}
197-
partitions?: ISplitPartition[]
194+
partitions?: IDefinitionPartition[]
198195
label?: string
199196
conditionType?: 'ROLLOUT' | 'WHITELIST'
200197
}
@@ -204,49 +201,44 @@ export interface IExcludedSegment {
204201
name: string,
205202
}
206203

207-
export interface IRBSegment {
208-
name: string,
209-
changeNumber: number,
210-
status?: 'ACTIVE' | 'ARCHIVED',
211-
conditions?: ISplitCondition[] | null,
204+
export interface TargetingEntity {
205+
name: string;
206+
changeNumber: number;
207+
status: 'ACTIVE' | 'ARCHIVED';
208+
conditions: IDefinitionCondition[];
209+
}
210+
211+
export interface IRBSegment extends TargetingEntity {
212212
excluded?: {
213213
keys?: string[] | null,
214214
segments?: IExcludedSegment[] | null
215215
} | null
216216
}
217217

218-
// @TODO: rename to IDefinition (Configs and Feature Flags are definitions)
219-
export interface ISplit {
220-
name: string,
221-
changeNumber: number,
222-
status?: 'ACTIVE' | 'ARCHIVED',
223-
conditions: ISplitCondition[],
218+
export interface IDefinition extends TargetingEntity {
219+
trafficTypeName: string;
220+
sets?: string[];
221+
impressionsDisabled?: boolean;
224222
prerequisites?: null | {
225223
n: string,
226224
ts: string[]
227-
}[]
228-
killed: boolean,
229-
defaultTreatment: string,
230-
trafficTypeName: string,
231-
seed: number,
232-
trafficAllocation?: number,
233-
trafficAllocationSeed?: number
225+
}[];
226+
killed: boolean;
227+
defaultTreatment: string;
228+
seed: number;
229+
trafficAllocation?: number;
230+
trafficAllocationSeed?: number;
234231
configurations?: {
235232
[treatmentName: string]: string | SplitIO.JsonObject
236-
},
237-
sets?: string[],
238-
impressionsDisabled?: boolean
233+
};
239234
}
240235

241-
// Split definition used in offline mode
242-
export type ISplitPartial = Pick<ISplit, 'conditions' | 'configurations' | 'trafficTypeName'>
243-
244236
/** Interface of the parsed JSON response of `/splitChanges` */
245-
export interface ISplitChangesResponse {
237+
export interface IDefinitionChangesResponse {
246238
ff?: {
247239
t: number,
248240
s?: number,
249-
d: ISplit[]
241+
d: IDefinition[]
250242
},
251243
rbs?: {
252244
t: number,

src/evaluator/Engine.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { keyParser } from '../utils/key';
44
import { thenable } from '../utils/promise/thenable';
55
import { NO_CONDITION_MATCH, SPLIT_ARCHIVED, SPLIT_KILLED, PREREQUISITES_NOT_MET } from '../utils/labels';
66
import { CONTROL } from '../utils/constants';
7-
import { ISplit, MaybeThenable } from '../dtos/types';
7+
import { IDefinition, MaybeThenable } from '../dtos/types';
88
import SplitIO from '../../types/splitio';
99
import { IStorageAsync, IStorageSync } from '../storages/types';
10-
import { IEvaluation, IEvaluationResult, ISplitEvaluator } from './types';
10+
import { IEvaluation, IEvaluationResult, IDefinitionEvaluator } from './types';
1111
import { ILogger } from '../logger/types';
1212
import { ENGINE_DEFAULT } from '../logger/constants';
1313
import { prerequisitesMatcherContext } from './matchers/prerequisites';
@@ -19,7 +19,7 @@ function evaluationResult(result: IEvaluation | undefined, defaultTreatment: str
1919
};
2020
}
2121

22-
export function engineParser(log: ILogger, split: ISplit, storage: IStorageSync | IStorageAsync) {
22+
export function engineParser(log: ILogger, split: IDefinition, storage: IStorageSync | IStorageAsync) {
2323
const { killed, seed, trafficAllocation, trafficAllocationSeed, status, conditions, prerequisites } = split;
2424

2525
const defaultTreatment = isString(split.defaultTreatment) ? split.defaultTreatment : CONTROL;
@@ -29,7 +29,7 @@ export function engineParser(log: ILogger, split: ISplit, storage: IStorageSync
2929

3030
return {
3131

32-
getTreatment(key: SplitIO.SplitKey, attributes: SplitIO.Attributes | undefined, splitEvaluator: ISplitEvaluator): MaybeThenable<IEvaluationResult> {
32+
getTreatment(key: SplitIO.SplitKey, attributes: SplitIO.Attributes | undefined, splitEvaluator: IDefinitionEvaluator): MaybeThenable<IEvaluationResult> {
3333

3434
const parsedKey = keyParser(key);
3535

src/evaluator/__tests__/evaluate-feature.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { evaluateFeature } from '../index';
2-
import { EXCEPTION, NOT_IN_SPLIT, SPLIT_ARCHIVED, SPLIT_KILLED, SPLIT_NOT_FOUND } from '../../utils/labels';
2+
import { EXCEPTION, NOT_IN_SPLIT, SPLIT_ARCHIVED, SPLIT_KILLED, DEFINITION_NOT_FOUND } from '../../utils/labels';
33
import { loggerMock } from '../../logger/__tests__/sdkLogger.mock';
4-
import { ISplit } from '../../dtos/types';
4+
import { IDefinition } from '../../dtos/types';
55
import { IStorageSync } from '../../storages/types';
66

7-
const splitsMock: Record<string, ISplit> = {
7+
const splitsMock: Record<string, IDefinition> = {
88
regular: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on', 'seed': 1684183541, 'configurations': {}, 'status': 'ACTIVE', 'killed': false, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
99
config: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on', 'seed': 1684183541, 'configurations': { 'on': "{color:'black'}" }, 'status': 'ACTIVE', 'killed': false, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
1010
killed: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on2', 'seed': 1684183541, 'configurations': {}, 'status': 'ACTIVE', 'killed': true, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
@@ -53,7 +53,7 @@ test('EVALUATOR / should return right label, treatment and config if storage ret
5353
config: '{color:\'black\'}', changeNumber: 1487277320548
5454
};
5555
const expectedOutputControl = {
56-
treatment: 'control', label: SPLIT_NOT_FOUND, config: null
56+
treatment: 'control', label: DEFINITION_NOT_FOUND, config: null
5757
};
5858

5959
const evaluationWithConfig = evaluateFeature(

src/evaluator/__tests__/evaluate-features.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { evaluateFeatures, evaluateFeaturesByFlagSets } from '../index';
2-
import { EXCEPTION, NOT_IN_SPLIT, SPLIT_ARCHIVED, SPLIT_KILLED, SPLIT_NOT_FOUND } from '../../utils/labels';
2+
import { EXCEPTION, NOT_IN_SPLIT, SPLIT_ARCHIVED, SPLIT_KILLED, DEFINITION_NOT_FOUND } from '../../utils/labels';
33
import { loggerMock } from '../../logger/__tests__/sdkLogger.mock';
44
import { WARN_FLAGSET_WITHOUT_FLAGS } from '../../logger/constants';
5-
import { ISplit } from '../../dtos/types';
5+
import { IDefinition } from '../../dtos/types';
66
import { IStorageSync } from '../../storages/types';
77

8-
const splitsMock: Record<string, ISplit> = {
8+
const splitsMock: Record<string, IDefinition> = {
99
regular: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on', 'seed': 1684183541, 'configurations': {}, 'status': 'ACTIVE', 'killed': false, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
1010
config: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on', 'seed': 1684183541, 'configurations': { 'on': "{color:'black'}" }, 'status': 'ACTIVE', 'killed': false, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
1111
killed: { 'changeNumber': 1487277320548, 'trafficAllocationSeed': 1667452163, 'trafficAllocation': 100, 'trafficTypeName': 'user', 'name': 'always-on2', 'seed': 1684183541, 'configurations': {}, 'status': 'ACTIVE', 'killed': true, 'defaultTreatment': 'off', 'conditions': [{ 'conditionType': 'ROLLOUT', 'matcherGroup': { 'combiner': 'AND', 'matchers': [{ 'keySelector': { 'trafficType': 'user', 'attribute': '' }, 'matcherType': 'ALL_KEYS', 'negate': false, 'userDefinedSegmentMatcherData': { 'segmentName': '' }, 'unaryNumericMatcherData': { 'dataType': null, 'value': 0 }, 'whitelistMatcherData': { 'whitelist': null }, 'betweenMatcherData': { 'dataType': null, 'start': 0, 'end': 0 } }] }, 'partitions': [{ 'treatment': 'on', 'size': 100 }, { 'treatment': 'off', 'size': 0 }], 'label': 'in segment all' }] },
@@ -33,7 +33,7 @@ const mockStorage = {
3333
return names.reduce((acc, name) => {
3434
acc[name] = this.getSplit(name);
3535
return acc;
36-
}, {} as Record<string, ISplit | null>);
36+
}, {} as Record<string, IDefinition | null>);
3737
},
3838
getNamesByFlagSets(flagSets: string[]) {
3939
return flagSets.map(flagset => flagSetsMock[flagset] || new Set());
@@ -71,7 +71,7 @@ test('EVALUATOR - Multiple evaluations at once / should return right labels, tre
7171
config: '{color:\'black\'}', changeNumber: 1487277320548
7272
},
7373
not_existent_split: {
74-
treatment: 'control', label: SPLIT_NOT_FOUND, config: null
74+
treatment: 'control', label: DEFINITION_NOT_FOUND, config: null
7575
},
7676
};
7777

@@ -122,7 +122,7 @@ describe('EVALUATOR - Multiple evaluations at once by flag sets', () => {
122122
config: '{color:\'black\'}', changeNumber: 1487277320548
123123
},
124124
not_existent_split: {
125-
treatment: 'control', label: SPLIT_NOT_FOUND, config: null
125+
treatment: 'control', label: DEFINITION_NOT_FOUND, config: null
126126
},
127127
};
128128

src/evaluator/combiners/and.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { findIndex } from '../../utils/lang';
22
import { ILogger } from '../../logger/types';
33
import { thenable } from '../../utils/promise/thenable';
44
import { MaybeThenable } from '../../dtos/types';
5-
import { ISplitEvaluator } from '../types';
5+
import { IDefinitionEvaluator } from '../types';
66
import { ENGINE_COMBINER_AND } from '../../logger/constants';
77
import SplitIO from '../../../types/splitio';
88

9-
export function andCombinerContext(log: ILogger, matchers: Array<(key: SplitIO.SplitKey, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => MaybeThenable<boolean>>) {
9+
export function andCombinerContext(log: ILogger, matchers: Array<(key: SplitIO.SplitKey, attributes?: SplitIO.Attributes, splitEvaluator?: IDefinitionEvaluator) => MaybeThenable<boolean>>) {
1010

1111
function andResults(results: boolean[]): boolean {
1212
// Array.prototype.every is supported by target environments
@@ -16,7 +16,7 @@ export function andCombinerContext(log: ILogger, matchers: Array<(key: SplitIO.S
1616
return hasMatchedAll;
1717
}
1818

19-
return function andCombiner(key: SplitIO.SplitKey, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator): MaybeThenable<boolean> {
19+
return function andCombiner(key: SplitIO.SplitKey, attributes?: SplitIO.Attributes, splitEvaluator?: IDefinitionEvaluator): MaybeThenable<boolean> {
2020
const matcherResults = matchers.map(matcher => matcher(key, attributes, splitEvaluator));
2121

2222
// If any matching result is a thenable we should use Promise.all

0 commit comments

Comments
 (0)