Skip to content

Commit 5daa34b

Browse files
authored
export bandit types (#114)
* export bandit types * bump feature version instead
1 parent 4161aa5 commit 5daa34b

File tree

5 files changed

+29
-20
lines changed

5 files changed

+29
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk-common",
3-
"version": "3.5.0",
3+
"version": "3.6.0",
44
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)",
55
"main": "dist/index.js",
66
"files": [

src/bandit-logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export interface IBanditEvent {
1717
}
1818

1919
export interface IBanditLogger {
20-
logBanditAction(assignment: IBanditEvent): void;
20+
logBanditAction(banditEvent: IBanditEvent): void;
2121
}

src/client/eppo-client.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface IEppoClient {
6060
getStringAssignment(
6161
flagKey: string,
6262
subjectKey: string,
63-
subjectAttributes: Record<string, AttributeType>,
63+
subjectAttributes: Attributes,
6464
defaultValue: string,
6565
): string;
6666

@@ -70,7 +70,7 @@ export interface IEppoClient {
7070
getBoolAssignment(
7171
flagKey: string,
7272
subjectKey: string,
73-
subjectAttributes: Record<string, AttributeType>,
73+
subjectAttributes: Attributes,
7474
defaultValue: boolean,
7575
): boolean;
7676

@@ -86,7 +86,7 @@ export interface IEppoClient {
8686
getBooleanAssignment(
8787
flagKey: string,
8888
subjectKey: string,
89-
subjectAttributes: Record<string, AttributeType>,
89+
subjectAttributes: Attributes,
9090
defaultValue: boolean,
9191
): boolean;
9292

@@ -102,7 +102,7 @@ export interface IEppoClient {
102102
getIntegerAssignment(
103103
flagKey: string,
104104
subjectKey: string,
105-
subjectAttributes: Record<string, AttributeType>,
105+
subjectAttributes: Attributes,
106106
defaultValue: number,
107107
): number;
108108

@@ -118,7 +118,7 @@ export interface IEppoClient {
118118
getNumericAssignment(
119119
flagKey: string,
120120
subjectKey: string,
121-
subjectAttributes: Record<string, AttributeType>,
121+
subjectAttributes: Attributes,
122122
defaultValue: number,
123123
): number;
124124

@@ -134,7 +134,7 @@ export interface IEppoClient {
134134
getJSONAssignment(
135135
flagKey: string,
136136
subjectKey: string,
137-
subjectAttributes: Record<string, AttributeType>,
137+
subjectAttributes: Attributes,
138138
defaultValue: object,
139139
): object;
140140

@@ -328,7 +328,7 @@ export default class EppoClient implements IEppoClient {
328328
public getStringAssignment(
329329
flagKey: string,
330330
subjectKey: string,
331-
subjectAttributes: Record<string, AttributeType>,
331+
subjectAttributes: Attributes,
332332
defaultValue: string,
333333
): string {
334334
return (
@@ -345,7 +345,7 @@ export default class EppoClient implements IEppoClient {
345345
public getBoolAssignment(
346346
flagKey: string,
347347
subjectKey: string,
348-
subjectAttributes: Record<string, AttributeType>,
348+
subjectAttributes: Attributes,
349349
defaultValue: boolean,
350350
): boolean {
351351
return this.getBooleanAssignment(flagKey, subjectKey, subjectAttributes, defaultValue);
@@ -354,7 +354,7 @@ export default class EppoClient implements IEppoClient {
354354
public getBooleanAssignment(
355355
flagKey: string,
356356
subjectKey: string,
357-
subjectAttributes: Record<string, AttributeType>,
357+
subjectAttributes: Attributes,
358358
defaultValue: boolean,
359359
): boolean {
360360
return (
@@ -371,7 +371,7 @@ export default class EppoClient implements IEppoClient {
371371
public getIntegerAssignment(
372372
flagKey: string,
373373
subjectKey: string,
374-
subjectAttributes: Record<string, AttributeType>,
374+
subjectAttributes: Attributes,
375375
defaultValue: number,
376376
): number {
377377
return (
@@ -388,7 +388,7 @@ export default class EppoClient implements IEppoClient {
388388
public getNumericAssignment(
389389
flagKey: string,
390390
subjectKey: string,
391-
subjectAttributes: Record<string, AttributeType>,
391+
subjectAttributes: Attributes,
392392
defaultValue: number,
393393
): number {
394394
return (
@@ -405,7 +405,7 @@ export default class EppoClient implements IEppoClient {
405405
public getJSONAssignment(
406406
flagKey: string,
407407
subjectKey: string,
408-
subjectAttributes: Record<string, AttributeType>,
408+
subjectAttributes: Attributes,
409409
defaultValue: object,
410410
): object {
411411
return (
@@ -599,7 +599,7 @@ export default class EppoClient implements IEppoClient {
599599
private getAssignmentVariation(
600600
flagKey: string,
601601
subjectKey: string,
602-
subjectAttributes: Record<string, AttributeType>,
602+
subjectAttributes: Attributes,
603603
defaultValue: EppoValue,
604604
expectedVariationType: VariationType,
605605
): EppoValue {
@@ -644,7 +644,7 @@ export default class EppoClient implements IEppoClient {
644644
public getAssignmentDetail(
645645
flagKey: string,
646646
subjectKey: string,
647-
subjectAttributes: Record<string, AttributeType> = {},
647+
subjectAttributes: Attributes = {},
648648
expectedVariationType?: VariationType,
649649
): FlagEvaluation {
650650
validateNotBlank(subjectKey, 'Invalid argument: subjectKey cannot be blank');

src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ApiEndpoints from './api-endpoints';
2-
import { logger } from './application-logger';
2+
import { logger as applicationLogger } from './application-logger';
33
import { IAssignmentHooks } from './assignment-hooks';
44
import { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
55
import { IBanditLogger, IBanditEvent } from './bandit-logger';
@@ -27,11 +27,17 @@ import { MemoryStore, MemoryOnlyConfigurationStore } from './configuration-store
2727
import * as constants from './constants';
2828
import HttpClient from './http-client';
2929
import { Flag, ObfuscatedFlag, VariationType } from './interfaces';
30-
import { AttributeType, Attributes } from './types';
30+
import {
31+
AttributeType,
32+
Attributes,
33+
BanditActions,
34+
BanditSubjectAttributes,
35+
ContextAttributes,
36+
} from './types';
3137
import * as validation from './validation';
3238

3339
export {
34-
logger as applicationLogger,
40+
applicationLogger,
3541
AbstractAssignmentCache,
3642
IAssignmentHooks,
3743
IAssignmentLogger,
@@ -72,4 +78,7 @@ export {
7278
VariationType,
7379
AttributeType,
7480
Attributes,
81+
ContextAttributes,
82+
BanditSubjectAttributes,
83+
BanditActions,
7584
};

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export type ValueType = string | number | boolean | JSON;
22
export type AttributeType = string | number | boolean;
33
export type ConditionValueType = AttributeType | AttributeType[];
4-
export type Attributes = { [key: string]: AttributeType };
4+
export type Attributes = Record<string, AttributeType>;
55
export type ContextAttributes = {
66
numericAttributes: Attributes;
77
categoricalAttributes: Attributes;

0 commit comments

Comments
 (0)