Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sameeran/ff 3830 bandits in precomputed init js client sdk #155

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk",
"version": "3.9.4",
"version": "3.9.5",
"description": "Eppo SDK for client-side JavaScript applications",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -63,4 +63,4 @@
"@eppo/js-client-sdk-common": "4.8.3"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
}
9 changes: 5 additions & 4 deletions src/i-client-config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {
AttributeType,
BanditSubjectAttributes,
ContextAttributes,
Flag,
IAssignmentLogger,
IAsyncStore,
IBanditLogger,
BanditActions,
} from '@eppo/js-client-sdk-common';
import type { FlagKey } from '@eppo/js-client-sdk-common/dist/types';

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

Expand Down Expand Up @@ -86,12 +87,12 @@ interface IPrecompute {
/**
* Subject attributes to use for precomputed flag assignments.
*/
subjectAttributes?: Record<string, AttributeType>;
subjectAttributes?: BanditSubjectAttributes;

/**
* Bandit actions to use for precomputed flag assignments.
*/
banditActions?: BanditActions;
banditActions?: Record<FlagKey, Record<string /*banditAction name*/, ContextAttributes>>;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ export async function precomputedInit(

const {
apiKey,
precompute: { subjectKey, subjectAttributes = {} },
precompute: { subjectKey, subjectAttributes = {}, banditActions },
baseUrl,
requestTimeoutMs,
numInitialRequestRetries,
Expand Down Expand Up @@ -658,6 +658,7 @@ export async function precomputedInit(
requestParameters,
subject,
precomputedBanditStore: memoryOnlyPrecomputedBanditsStore,
banditActions,
});

EppoPrecomputedJSClient.instance.setAssignmentLogger(config.assignmentLogger);
Expand Down
Loading