Skip to content

Commit c9aaf08

Browse files
authored
Sameeran/ff 3830 bandits in precomputed init js client sdk (#155)
* fix: include banditActions when instantiating EppoPrecomputedJSClient * v3.9.5
1 parent 5a822ca commit c9aaf08

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk",
3-
"version": "3.9.4",
3+
"version": "3.9.5",
44
"description": "Eppo SDK for client-side JavaScript applications",
55
"main": "dist/index.js",
66
"files": [
@@ -63,4 +63,4 @@
6363
"@eppo/js-client-sdk-common": "4.8.3"
6464
},
6565
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
66-
}
66+
}

src/i-client-config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {
2-
AttributeType,
2+
BanditSubjectAttributes,
3+
ContextAttributes,
34
Flag,
45
IAssignmentLogger,
56
IAsyncStore,
67
IBanditLogger,
7-
BanditActions,
88
} from '@eppo/js-client-sdk-common';
9+
import type { FlagKey } from '@eppo/js-client-sdk-common/dist/types';
910

1011
import { ServingStoreUpdateStrategy } from './isolatable-hybrid.store';
1112

@@ -86,12 +87,12 @@ interface IPrecompute {
8687
/**
8788
* Subject attributes to use for precomputed flag assignments.
8889
*/
89-
subjectAttributes?: Record<string, AttributeType>;
90+
subjectAttributes?: BanditSubjectAttributes;
9091

9192
/**
9293
* Bandit actions to use for precomputed flag assignments.
9394
*/
94-
banditActions?: BanditActions;
95+
banditActions?: Record<FlagKey, Record<string /*banditAction name*/, ContextAttributes>>;
9596
}
9697

9798
/**

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ export async function precomputedInit(
624624

625625
const {
626626
apiKey,
627-
precompute: { subjectKey, subjectAttributes = {} },
627+
precompute: { subjectKey, subjectAttributes = {}, banditActions },
628628
baseUrl,
629629
requestTimeoutMs,
630630
numInitialRequestRetries,
@@ -658,6 +658,7 @@ export async function precomputedInit(
658658
requestParameters,
659659
subject,
660660
precomputedBanditStore: memoryOnlyPrecomputedBanditsStore,
661+
banditActions,
661662
});
662663

663664
EppoPrecomputedJSClient.instance.setAssignmentLogger(config.assignmentLogger);

0 commit comments

Comments
 (0)