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

Expose bandit logger types #65

Merged
merged 4 commits into from
Jul 9, 2024
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
5 changes: 5 additions & 0 deletions node-server-sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { IAssignmentEvent } from '@eppo/js-client-sdk-common';
import { IAssignmentLogger } from '@eppo/js-client-sdk-common';
import { IBanditEvent } from '@eppo/js-client-sdk-common';
import { IBanditLogger } from '@eppo/js-client-sdk-common';
import { IEppoClient } from '@eppo/js-client-sdk-common';

Expand All @@ -16,6 +17,10 @@ export { IAssignmentEvent }

export { IAssignmentLogger }

export { IBanditEvent }

export { IBanditLogger }

// @public
export interface IClientConfig {
apiKey: string;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/node-server-sdk",
"version": "3.1.0",
"version": "3.1.1",
"description": "Eppo node server SDK",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Eppo-exp/node-server-sdk#readme",
"dependencies": {
"@eppo/js-client-sdk-common": "3.5.0",
"@eppo/js-client-sdk-common": "3.6.0",
"lru-cache": "^10.0.1"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ export interface IClientConfig {
pollAfterFailedInitialization?: boolean;
}

export { IAssignmentEvent, IAssignmentLogger } from '@eppo/js-client-sdk-common';
export {
IAssignmentEvent,
IAssignmentLogger,
IBanditEvent,
IBanditLogger,
} from '@eppo/js-client-sdk-common';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we also want to expose any of the following:

  • Attributes - used for subject attributes
  • ContextAttributes - used with bandits when explicitly separating out numerical and categorical attributes
  • `BanditSubjectAttributes - used with bandits
  • BanditActions - used with bandits

Link to types: https://github.com/Eppo-exp/js-client-sdk-common/blob/main/src/types.ts

Example method signatures:

getBanditAction(
  flagKey: string,
  subjectKey: string,
  subjectAttributes: BanditSubjectAttributes,
  actions: BanditActions,
  defaultValue: string,
): { variation: string; action: string | null };

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like yes, if those are part of the public API!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are my thoughts as well.

Note this requires a change to the common SDK. Pr for that here: Eppo-exp/js-sdk-common#114


let clientInstance: IEppoClient;

Expand Down
3 changes: 2 additions & 1 deletion test/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export function validateTestAssignments(
// the expect works well for objects, but this comparison does not
if (assignment !== subject.assignment) {
throw new Error(
`subject ${subject.subjectKey
`subject ${
subject.subjectKey
} was assigned ${assignment?.toString()} when expected ${subject.assignment?.toString()} for flag ${flag}`,
);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,10 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@eppo/js-client-sdk-common@3.5.0":
version "3.5.0"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.5.0.tgz#456616067a7044707828eea596cf6915d9c21c71"
integrity sha512-uCzPXRq7Z7Ir8a9XDz0YU3TP5F1vKYtKqXSjRjqViDSBBfbdTkHBNh1zeA3hEdpppjQKZHExbV1Stl0rmNWznw==
"@eppo/js-client-sdk-common@3.6.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.6.0.tgz#b67cff89809f10df8a1b5619c4e6bec701f6d2c8"
integrity sha512-9G43xdGUwLJPiwvO6OUTqwFuko6nvD6FgrsCUroRVPQbHrOnWbyylAE8h2vwbxIhSTlLwxS0xRqWO+WEYiWepA==
dependencies:
js-base64 "^3.7.7"
md5 "^2.3.0"
Expand Down
Loading