-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtypes.ts
More file actions
34 lines (26 loc) · 1.45 KB
/
types.ts
File metadata and controls
34 lines (26 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { IBetweenMatcherData, IBetweenStringMatcherData, IDependencyMatcherData, MaybeThenable } from '../dtos/types';
import { IStorageAsync, IStorageSync } from '../storages/types';
import SplitIO from '../../types/splitio';
import { ILogger } from '../logger/types';
export interface IDependencyMatcherValue {
key: SplitIO.SplitKey,
attributes?: SplitIO.Attributes
}
export interface IMatcherDto {
type: number
name: string
value?: string | number | boolean | string[] | IDependencyMatcherData | IBetweenMatcherData | IBetweenStringMatcherData | null
attribute?: string | null
negate?: boolean
dataType: string
}
export interface IEvaluation {
treatment?: string,
label: string,
changeNumber?: number,
config?: string | object | null
}
export type IEvaluationResult = IEvaluation & { treatment: string; impressionsDisabled?: boolean }
export type ISplitEvaluator = (log: ILogger, key: SplitIO.SplitKey | undefined, splitName: string, attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync) => MaybeThenable<IEvaluation>
export type IEvaluator = (key?: SplitIO.SplitKeyObject, seed?: number, trafficAllocation?: number, trafficAllocationSeed?: number, attributes?: SplitIO.Attributes, splitEvaluator?: ISplitEvaluator) => MaybeThenable<IEvaluation | boolean | undefined>
export type IMatcher = (value: string | number | boolean | string[] | IDependencyMatcherValue, splitEvaluator?: ISplitEvaluator) => MaybeThenable<boolean>