@@ -10,14 +10,16 @@ import {
1010} from '../attributes' ;
1111import { BanditEvaluation , BanditEvaluator } from '../bandit-evaluator' ;
1212import { IBanditEvent , IBanditLogger } from '../bandit-logger' ;
13+ import { BroadcastChannel } from '../broadcast' ;
1314import { AssignmentCache } from '../cache/abstract-assignment-cache' ;
1415import { LRUInMemoryAssignmentCache } from '../cache/lru-in-memory-assignment-cache' ;
1516import { NonExpiringInMemoryAssignmentCache } from '../cache/non-expiring-in-memory-cache-assignment' ;
1617import { TLRUInMemoryAssignmentCache } from '../cache/tlru-in-memory-assignment-cache' ;
1718import { Configuration , PrecomputedConfig } from '../configuration' ;
19+ import { ConfigurationSource } from '../configuration-feed' ;
20+ import { randomJitterMs , ConfigurationPoller } from '../configuration-poller' ;
1821import ConfigurationRequestor from '../configuration-requestor' ;
1922import { ConfigurationStore } from '../configuration-store' ;
20- import { IObfuscatedPrecomputedConfigurationResponse } from '../precomputed-configuration' ;
2123import {
2224 DEFAULT_BASE_POLLING_INTERVAL_MS ,
2325 DEFAULT_MAX_POLLING_INTERVAL_MS ,
@@ -30,6 +32,7 @@ import {
3032 DEFAULT_ENABLE_POLLING ,
3133 DEFAULT_ENABLE_BANDITS ,
3234} from '../constants' ;
35+ import { decodePrecomputedBandit , decodePrecomputedFlag } from '../decoding' ;
3336import { EppoValue } from '../eppo_value' ;
3437import {
3538 AssignmentResult ,
@@ -56,8 +59,19 @@ import {
5659 Variation ,
5760 VariationType ,
5861} from '../interfaces' ;
62+ import { KVStore , MemoryStore } from '../kvstore' ;
63+ import {
64+ getMD5Hash ,
65+ obfuscatePrecomputedBanditMap ,
66+ obfuscatePrecomputedFlags ,
67+ } from '../obfuscation' ;
5968import { OverridePayload , OverrideValidator } from '../override-validator' ;
60- import { randomJitterMs } from '../configuration-poller' ;
69+ import {
70+ PersistentConfigurationCache ,
71+ PersistentConfigurationStorage ,
72+ } from '../persistent-configuration-cache' ;
73+ import { IObfuscatedPrecomputedConfigurationResponse } from '../precomputed-configuration' ;
74+ import { generateSalt } from '../salt' ;
6175import SdkTokenDecoder from '../sdk-token-decoder' ;
6276import {
6377 Attributes ,
@@ -71,22 +85,8 @@ import {
7185import { shallowClone } from '../util' ;
7286import { validateNotBlank } from '../validation' ;
7387import { LIB_VERSION } from '../version' ;
74- import {
75- PersistentConfigurationCache ,
76- PersistentConfigurationStorage ,
77- } from '../persistent-configuration-cache' ;
78- import { ConfigurationPoller } from '../configuration-poller' ;
79- import { ConfigurationSource } from '../configuration-feed' ;
80- import { BroadcastChannel } from '../broadcast' ;
81- import {
82- getMD5Hash ,
83- obfuscatePrecomputedBanditMap ,
84- obfuscatePrecomputedFlags ,
85- } from '../obfuscation' ;
86- import { decodePrecomputedBandit , decodePrecomputedFlag } from '../decoding' ;
88+
8789import { Subject } from './subject' ;
88- import { generateSalt } from '../salt' ;
89- import { KVStore , MemoryStore } from '../kvstore' ;
9090
9191export interface IAssignmentDetails < T extends Variation [ 'value' ] | object > {
9292 variation : T ;
@@ -264,16 +264,6 @@ export type EppoClientParameters = {
264264 } ;
265265} ;
266266
267- type VariationTypeMap = {
268- [ VariationType . STRING ] : string ;
269- [ VariationType . INTEGER ] : number ;
270- [ VariationType . NUMERIC ] : number ;
271- [ VariationType . BOOLEAN ] : boolean ;
272- [ VariationType . JSON ] : object ;
273- } ;
274-
275- type TypeFromVariationType < T extends VariationType > = VariationTypeMap [ T ] ;
276-
277267/**
278268 * ## Initialization
279269 *
@@ -1018,8 +1008,6 @@ export default class EppoClient {
10181008 const precomputed = config . getPrecomputedConfiguration ( ) ;
10191009 if ( precomputed && precomputed . subjectKey === subjectKey ) {
10201010 // Use precomputed results if available
1021- const nonContextualSubjectAttributes =
1022- ensureNonContextualSubjectAttributes ( subjectAttributes ) ;
10231011 const { flagEvaluation, banditAction, assignmentEvent, banditEvent } =
10241012 this . evaluatePrecomputedAssignment ( precomputed , flagKey , VariationType . STRING ) ;
10251013
@@ -1940,9 +1928,9 @@ class TimeoutError extends Error {
19401928function withTimeout < T > ( promise : Promise < T > , ms : number ) : Promise < T > {
19411929 let timer : NodeJS . Timeout ;
19421930
1943- const timeoutPromise = new Promise < never > ( ( _ , reject ) => {
1931+ const timeoutPromise = new Promise < never > ( ( _resolve , reject ) => {
19441932 timer = setTimeout ( ( ) => reject ( new TimeoutError ( ) ) , ms ) ;
19451933 } ) ;
19461934
1947- return Promise . race ( [ promise , timeoutPromise ] ) . finally ( ( ) => clearTimeout ( timer ! ) ) ;
1935+ return Promise . race ( [ promise , timeoutPromise ] ) . finally ( ( ) => clearTimeout ( timer ) ) ;
19481936}
0 commit comments