Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6241b0f
Extract SDK lifecycle methods (init, flush, destroy) into separate mo…
EmilianoSanchez Mar 9, 2026
e4289de
Merge branch 'refactor-impressions-tracker' into configs-sdk-client
EmilianoSanchez Mar 10, 2026
008756a
Merge branch 'refactor-impressions-tracker' into configs-sdk-client
EmilianoSanchez Mar 11, 2026
767324d
Add IConfig DTO and Configs SDK client wrapper
EmilianoSanchez Mar 12, 2026
57300db
Handle undefined key in evaluator to support evaluation without key/t…
EmilianoSanchez Mar 13, 2026
6a6febd
Merge branch 'refactor-evaluator-to-support-no-target' into configs-s…
EmilianoSanchez Mar 13, 2026
c396555
Consolidate impression logging into single message when queueing
EmilianoSanchez Mar 13, 2026
74ac2e6
Merge branch 'refactor-evaluator-to-support-no-target' into configs-s…
EmilianoSanchez Mar 13, 2026
64feb01
Consolidate impression logging into single message when queueing
EmilianoSanchez Mar 13, 2026
ee756a0
Merge branch 'refactor-evaluator-to-support-no-target' into configs-s…
EmilianoSanchez Mar 13, 2026
df9f00f
Refactor /splitChanges DTO to make the SDK more robust in case of nul…
EmilianoSanchez Mar 13, 2026
021086f
Merge branch 'refactor-evaluator-to-support-no-target' into configs-s…
EmilianoSanchez Mar 13, 2026
c3d9730
Rename SPLIT_NOT_FOUND to DEFINITION_NOT_FOUND and update related ref…
EmilianoSanchez Mar 13, 2026
30d102f
Remove feature flag name from SDK not ready warning message and simpl…
EmilianoSanchez Mar 13, 2026
858bb96
Polishing
EmilianoSanchez Mar 13, 2026
2897640
Merge branch 'refactor-fallback-calculator' into refactor-evaluator-t…
EmilianoSanchez Mar 18, 2026
bd199f0
Merge branch 'sdk-configs-baseline' into refactor-evaluator-to-suppor…
EmilianoSanchez Mar 18, 2026
7004f30
Merge branch 'refactor-evaluator-to-support-no-target' into configs-s…
EmilianoSanchez Mar 18, 2026
aabd919
Add IConfig interface and fetchConfigs method
EmilianoSanchez Mar 18, 2026
f75580e
Merge branch 'sdk-configs-handle-configs-dto' into configs-sdk-client
EmilianoSanchez Mar 18, 2026
38a9f3a
Merge branch 'refactor-fallback-calculator' into configs-sdk-client
EmilianoSanchez Mar 18, 2026
da3ecc0
Rename split to definition in logs and declarations to generalize the…
EmilianoSanchez Mar 18, 2026
51724d3
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Mar 19, 2026
71912ea
Merge branch 'sdk-configs-baseline' into refactor-evaluator-to-suppor…
EmilianoSanchez Mar 19, 2026
56fad13
Merge branch 'refactor-evaluator-to-support-no-target' into sdk-confi…
EmilianoSanchez Mar 19, 2026
4614e36
Fix
EmilianoSanchez Mar 19, 2026
f79a75c
Merge branch 'sdk-configs-handle-configs-dto' into sdk-configs-rename…
EmilianoSanchez Mar 19, 2026
db9e597
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Mar 19, 2026
92170bc
support configs fetcher
EmilianoSanchez Mar 19, 2026
aa9ff60
rename
EmilianoSanchez Mar 19, 2026
485d432
Add CONFIGS_UPDATE constant and update splitChangesUpdater for config…
EmilianoSanchez Mar 23, 2026
e0db405
Polishing
EmilianoSanchez Mar 23, 2026
3aed036
Add default condition handling in configsFetcher and update defaultTr…
EmilianoSanchez Mar 23, 2026
7c4bd31
Merge branch 'sdk-configs-handle-configs-dto' into sdk-configs-rename…
EmilianoSanchez Mar 23, 2026
5e6932a
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Mar 23, 2026
c64b57a
Simplify configsFetcher
EmilianoSanchez Mar 23, 2026
b9cb6ed
Merge branch 'sdk-configs-handle-configs-dto' into configs-sdk-client
EmilianoSanchez Mar 23, 2026
12ee171
Merge branch 'sdk-configs-baseline' into refactor-evaluator-to-suppor…
EmilianoSanchez Mar 19, 2026
d4e5cd5
Add evaluateDefaultTreatment function to handle default treatment eva…
EmilianoSanchez Mar 25, 2026
fc89992
Refactor evaluation handling
EmilianoSanchez Mar 25, 2026
8ec6a80
Merge branch 'refactor-evaluator-to-support-no-target' into sdk-confi…
EmilianoSanchez Mar 25, 2026
7e6e97d
Merge branch 'sdk-configs-handle-configs-dto' into sdk-configs-rename…
EmilianoSanchez Mar 25, 2026
41a2e3e
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Mar 25, 2026
5737b6f
fix
EmilianoSanchez Apr 7, 2026
a1f9344
Add TS definitions for Configs SDK
EmilianoSanchez Apr 8, 2026
5e68127
Update Configs DTO
EmilianoSanchez Apr 8, 2026
280d487
Merge branch 'sdk-configs-handle-configs-dto' into sdk-configs-fallba…
EmilianoSanchez Apr 8, 2026
7f1ca74
Add fallback configuration calculator and sanitizer with correspondin…
EmilianoSanchez Apr 8, 2026
0db72ee
Test
EmilianoSanchez Apr 8, 2026
f41c1de
Refactor clientInputValidation tests to remove unnecessary type annot…
EmilianoSanchez Apr 8, 2026
68f0f17
Merge pull request #487 from splitio/sdk-configs-fallback-configs
EmilianoSanchez Apr 8, 2026
6aa1d57
Merge pull request #482 from splitio/sdk-configs-handle-configs-dto
EmilianoSanchez Apr 8, 2026
abfc21a
Merge pull request #481 from splitio/refactor-evaluator-to-support-no…
EmilianoSanchez Apr 8, 2026
513637c
Merge branch 'sdk-configs-baseline' into sdk-configs-rename-split-to-…
EmilianoSanchez Apr 8, 2026
9e20ea4
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Apr 8, 2026
e86fe01
Update ConfigsFetcher with new DTO
EmilianoSanchez Apr 9, 2026
c4c882b
Merge branch 'sdk-configs-baseline' into sdk-configs-rename-split-to-…
EmilianoSanchez Apr 9, 2026
738d872
Rename ISplit to IDefinition
EmilianoSanchez Apr 9, 2026
b597c53
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Apr 9, 2026
1c77831
Remove redundant comments
EmilianoSanchez Apr 9, 2026
0a84376
Merge branch 'sdk-configs-rename-split-to-definition' into configs-sd…
EmilianoSanchez Apr 9, 2026
28c6273
Update logs
EmilianoSanchez Apr 13, 2026
ead8216
Update Configs endpoint path and conversion
EmilianoSanchez Apr 13, 2026
b614d6f
Merge branch 'sdk-configs-endpoint-updates' into configs-sdk-client
EmilianoSanchez Apr 13, 2026
7f31beb
Merge pull request #483 from splitio/sdk-configs-rename-split-to-defi…
EmilianoSanchez Apr 13, 2026
3810b80
Merge branch 'sdk-configs-baseline' into sdk-configs-endpoint-updates
EmilianoSanchez Apr 13, 2026
caf6640
Rename validation utils
EmilianoSanchez Apr 13, 2026
59dba66
Merge branch 'sdk-configs-baseline' into sdk-configs-endpoint-updates
EmilianoSanchez Apr 13, 2026
4620cdc
Merge branch 'sdk-configs-endpoint-updates' into configs-sdk-client
EmilianoSanchez Apr 13, 2026
9b7d541
New SDK_UPDATE metadata type
EmilianoSanchez Apr 13, 2026
57992f2
Merge branch 'sdk-configs-baseline' into sdk-configs-endpoint-updates
EmilianoSanchez Apr 13, 2026
cbdc76a
Merge branch 'sdk-configs-endpoint-updates' into configs-sdk-client
EmilianoSanchez Apr 13, 2026
d47ec73
Revert unused code
EmilianoSanchez Apr 13, 2026
216a9e3
Move code to configs-client repo
EmilianoSanchez Apr 13, 2026
907adcc
Merge pull request #490 from splitio/sdk-configs-endpoint-updates
EmilianoSanchez Apr 13, 2026
a396bcd
Merge pull request #484 from splitio/configs-sdk-client
EmilianoSanchez Apr 13, 2026
fb07ac3
Merge branch 'development' into sdk-configs-baseline
EmilianoSanchez Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"root": true,
"extends": [
"eslint:recommended"
],
Expand Down
22 changes: 16 additions & 6 deletions package-lock.json

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

111 changes: 52 additions & 59 deletions src/dtos/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import SplitIO from '../../types/splitio';

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

/** Split Matchers */

export type IMatcherDataType = null | 'DATETIME' | 'NUMBER'

export interface IUnaryNumericMatcherData {
Expand Down Expand Up @@ -39,7 +37,7 @@ export interface IDependencyMatcherData {
treatments: string[]
}

interface ISplitMatcherBase {
interface IDefinitionMatcherBase {
matcherType: string
negate?: boolean
keySelector?: null | {
Expand All @@ -57,144 +55,143 @@ interface ISplitMatcherBase {
betweenStringMatcherData?: null | IBetweenStringMatcherData
}

interface IAllKeysMatcher extends ISplitMatcherBase {
interface IAllKeysMatcher extends IDefinitionMatcherBase {
matcherType: 'ALL_KEYS'
}

interface IInSegmentMatcher extends ISplitMatcherBase {
interface IInSegmentMatcher extends IDefinitionMatcherBase {
matcherType: 'IN_SEGMENT',
userDefinedSegmentMatcherData: IInSegmentMatcherData
}

interface IInRBSegmentMatcher extends ISplitMatcherBase {
interface IInRBSegmentMatcher extends IDefinitionMatcherBase {
matcherType: 'IN_RULE_BASED_SEGMENT',
userDefinedSegmentMatcherData: IInSegmentMatcherData
}

interface IInLargeSegmentMatcher extends ISplitMatcherBase {
interface IInLargeSegmentMatcher extends IDefinitionMatcherBase {
matcherType: 'IN_LARGE_SEGMENT',
userDefinedLargeSegmentMatcherData: IInLargeSegmentMatcherData
}

interface IWhitelistMatcher extends ISplitMatcherBase {
interface IWhitelistMatcher extends IDefinitionMatcherBase {
matcherType: 'WHITELIST',
whitelistMatcherData: IWhitelistMatcherData
}

interface IEqualToMatcher extends ISplitMatcherBase {
interface IEqualToMatcher extends IDefinitionMatcherBase {
matcherType: 'EQUAL_TO',
unaryNumericMatcherData: IUnaryNumericMatcherData
}

interface IGreaterThanOrEqualToMatcher extends ISplitMatcherBase {
interface IGreaterThanOrEqualToMatcher extends IDefinitionMatcherBase {
matcherType: 'GREATER_THAN_OR_EQUAL_TO',
unaryNumericMatcherData: IUnaryNumericMatcherData
}

interface ILessThanOrEqualToMatcher extends ISplitMatcherBase {
interface ILessThanOrEqualToMatcher extends IDefinitionMatcherBase {
matcherType: 'LESS_THAN_OR_EQUAL_TO',
unaryNumericMatcherData: IUnaryNumericMatcherData
}

interface IBetweenMatcher extends ISplitMatcherBase {
interface IBetweenMatcher extends IDefinitionMatcherBase {
matcherType: 'BETWEEN'
betweenMatcherData: IBetweenMatcherData
}

interface IEqualToSetMatcher extends ISplitMatcherBase {
interface IEqualToSetMatcher extends IDefinitionMatcherBase {
matcherType: 'EQUAL_TO_SET',
whitelistMatcherData: IWhitelistMatcherData
}

interface IContainsAnyOfSetMatcher extends ISplitMatcherBase {
interface IContainsAnyOfSetMatcher extends IDefinitionMatcherBase {
matcherType: 'CONTAINS_ANY_OF_SET',
whitelistMatcherData: IWhitelistMatcherData
}

interface IContainsAllOfSetMatcher extends ISplitMatcherBase {
interface IContainsAllOfSetMatcher extends IDefinitionMatcherBase {
matcherType: 'CONTAINS_ALL_OF_SET',
whitelistMatcherData: IWhitelistMatcherData
}

interface IPartOfSetMatcher extends ISplitMatcherBase {
interface IPartOfSetMatcher extends IDefinitionMatcherBase {
matcherType: 'PART_OF_SET',
whitelistMatcherData: IWhitelistMatcherData
}

interface IStartsWithMatcher extends ISplitMatcherBase {
interface IStartsWithMatcher extends IDefinitionMatcherBase {
matcherType: 'STARTS_WITH',
whitelistMatcherData: IWhitelistMatcherData
}

interface IEndsWithMatcher extends ISplitMatcherBase {
interface IEndsWithMatcher extends IDefinitionMatcherBase {
matcherType: 'ENDS_WITH',
whitelistMatcherData: IWhitelistMatcherData
}

interface IContainsStringMatcher extends ISplitMatcherBase {
interface IContainsStringMatcher extends IDefinitionMatcherBase {
matcherType: 'CONTAINS_STRING',
whitelistMatcherData: IWhitelistMatcherData
}

interface IInSplitTreatmentMatcher extends ISplitMatcherBase {
interface IInSplitTreatmentMatcher extends IDefinitionMatcherBase {
matcherType: 'IN_SPLIT_TREATMENT',
dependencyMatcherData: IDependencyMatcherData,
}

interface IEqualToBooleanMatcher extends ISplitMatcherBase {
interface IEqualToBooleanMatcher extends IDefinitionMatcherBase {
matcherType: 'EQUAL_TO_BOOLEAN',
booleanMatcherData: boolean
}

interface IMatchesStringMatcher extends ISplitMatcherBase {
interface IMatchesStringMatcher extends IDefinitionMatcherBase {
matcherType: 'MATCHES_STRING',
stringMatcherData: string
}

interface IEqualToSemverMatcher extends ISplitMatcherBase {
interface IEqualToSemverMatcher extends IDefinitionMatcherBase {
matcherType: 'EQUAL_TO_SEMVER',
stringMatcherData: string
}

interface IGreaterThanOrEqualToSemverMatcher extends ISplitMatcherBase {
interface IGreaterThanOrEqualToSemverMatcher extends IDefinitionMatcherBase {
matcherType: 'GREATER_THAN_OR_EQUAL_TO_SEMVER',
stringMatcherData: string
}


interface ILessThanOrEqualToSemverMatcher extends ISplitMatcherBase {
interface ILessThanOrEqualToSemverMatcher extends IDefinitionMatcherBase {
matcherType: 'LESS_THAN_OR_EQUAL_TO_SEMVER',
stringMatcherData: string
}

interface IBetweenSemverMatcher extends ISplitMatcherBase {
interface IBetweenSemverMatcher extends IDefinitionMatcherBase {
matcherType: 'BETWEEN_SEMVER'
betweenStringMatcherData: IBetweenStringMatcherData
}

interface IInListSemverMatcher extends ISplitMatcherBase {
interface IInListSemverMatcher extends IDefinitionMatcherBase {
matcherType: 'IN_LIST_SEMVER',
whitelistMatcherData: IWhitelistMatcherData
}

export type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher |
export type IDefinitionMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher |
ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher |
IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher |
IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher |
IInLargeSegmentMatcher | IInRBSegmentMatcher

/** Split object */
export interface ISplitPartition {
export interface IDefinitionPartition {
treatment: string
size: number
}

export interface ISplitCondition {
export interface IDefinitionCondition {
matcherGroup: {
combiner: 'AND',
matchers: ISplitMatcher[]
matchers: IDefinitionMatcher[]
}
partitions?: ISplitPartition[]
partitions?: IDefinitionPartition[]
label?: string
conditionType?: 'ROLLOUT' | 'WHITELIST'
}
Expand All @@ -204,48 +201,44 @@ export interface IExcludedSegment {
name: string,
}

export interface IRBSegment {
name: string,
changeNumber: number,
status?: 'ACTIVE' | 'ARCHIVED',
conditions?: ISplitCondition[] | null,
export interface TargetingEntity {
name: string;
changeNumber: number;
status: 'ACTIVE' | 'ARCHIVED';
conditions: IDefinitionCondition[];
}

export interface IRBSegment extends TargetingEntity {
excluded?: {
keys?: string[] | null,
segments?: IExcludedSegment[] | null
} | null
}

export interface ISplit {
name: string,
changeNumber: number,
status?: 'ACTIVE' | 'ARCHIVED',
conditions: ISplitCondition[],
export interface IDefinition extends TargetingEntity {
trafficTypeName: string;
sets?: string[];
impressionsDisabled?: boolean;
prerequisites?: null | {
n: string,
ts: string[]
}[]
killed: boolean,
defaultTreatment: string,
trafficTypeName: string,
seed: number,
trafficAllocation?: number,
trafficAllocationSeed?: number
}[];
killed: boolean;
defaultTreatment: string;
seed: number;
trafficAllocation?: number;
trafficAllocationSeed?: number;
configurations?: {
[treatmentName: string]: string
},
sets?: string[],
impressionsDisabled?: boolean
[treatmentName: string]: string | SplitIO.JsonObject
};
}

// Split definition used in offline mode
export type ISplitPartial = Pick<ISplit, 'conditions' | 'configurations' | 'trafficTypeName'>

/** Interface of the parsed JSON response of `/splitChanges` */
export interface ISplitChangesResponse {
export interface IDefinitionChangesResponse {
ff?: {
t: number,
s?: number,
d: ISplit[]
d: IDefinition[]
},
rbs?: {
t: number,
Expand Down
8 changes: 4 additions & 4 deletions src/evaluator/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { keyParser } from '../utils/key';
import { thenable } from '../utils/promise/thenable';
import { NO_CONDITION_MATCH, SPLIT_ARCHIVED, SPLIT_KILLED, PREREQUISITES_NOT_MET } from '../utils/labels';
import { CONTROL } from '../utils/constants';
import { ISplit, MaybeThenable } from '../dtos/types';
import { IDefinition, MaybeThenable } from '../dtos/types';
import SplitIO from '../../types/splitio';
import { IStorageAsync, IStorageSync } from '../storages/types';
import { IEvaluation, IEvaluationResult, ISplitEvaluator } from './types';
import { IEvaluation, IEvaluationResult, IDefinitionEvaluator } from './types';
import { ILogger } from '../logger/types';
import { ENGINE_DEFAULT } from '../logger/constants';
import { prerequisitesMatcherContext } from './matchers/prerequisites';
Expand All @@ -19,7 +19,7 @@ function evaluationResult(result: IEvaluation | undefined, defaultTreatment: str
};
}

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

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

return {

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

const parsedKey = keyParser(key);

Expand Down
Loading