Skip to content

Commit 8ae88b9

Browse files
authored
feat: export FlagKey type and fix some lint warnings (#205)
* feat: export FlagKey type * (fix): lint warnings * feat: more exports * (chore): bump version to 4.8.4
1 parent 7ed9206 commit 8ae88b9

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
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": "4.8.3",
3+
"version": "4.8.4",
44
"description": "Common library for Eppo JavaScript SDKs (web, react native, and node)",
55
"main": "dist/index.js",
66
"files": [

src/client/eppo-precomputed-client-with-bandits.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ describe('EppoPrecomputedClient Bandits E2E test', () => {
1717
const mockLogAssignment = jest.fn();
1818
const mockLogBanditAction = jest.fn();
1919

20-
const salt = 'NaCl';
21-
2220
const precomputedConfigurationWire = readMockConfigurationWireResponse(
2321
MOCK_DEOBFUSCATED_PRECOMPUTED_RESPONSE_FILE,
2422
);
@@ -31,7 +29,7 @@ describe('EppoPrecomputedClient Bandits E2E test', () => {
3129
beforeAll(async () => {
3230
if (mode === 'online') {
3331
// Mock fetch for online mode
34-
global.fetch = jest.fn((url: string) => {
32+
global.fetch = jest.fn(() => {
3533
return Promise.resolve({
3634
ok: true,
3735
status: 200,

src/client/eppo-precomputed-client.spec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,6 @@ describe('EppoPrecomputedClient E2E test', () => {
735735
});
736736
precomputedFlagStore.salt = salt;
737737

738-
const requestParameters: PrecomputedFlagsRequestParameters = {
739-
apiKey: 'DUMMY_API_KEY',
740-
sdkName: 'js-precomputed-test',
741-
sdkVersion: '100.0.1',
742-
};
743-
744738
const client = new EppoPrecomputedClient({
745739
precomputedFlagStore,
746740
subject,
@@ -869,7 +863,6 @@ describe('Precomputed Bandit Store', () => {
869863
let precomputedFlagStore: IConfigurationStore<PrecomputedFlag>;
870864
let precomputedBanditStore: IConfigurationStore<IObfuscatedPrecomputedBandit>;
871865
let subject: Subject;
872-
let mockLogger: IAssignmentLogger;
873866

874867
beforeEach(() => {
875868
precomputedFlagStore = new MemoryOnlyConfigurationStore<PrecomputedFlag>();
@@ -878,14 +871,13 @@ describe('Precomputed Bandit Store', () => {
878871
subjectKey: 'test-subject',
879872
subjectAttributes: { attr1: 'value1' },
880873
};
881-
mockLogger = td.object<IAssignmentLogger>();
882874
});
883875

884876
it('prints errors if initialized with a bandit store that is not initialized and without requestParameters', () => {
885877
const loggerErrorSpy = jest.spyOn(logger, 'error');
886878
const loggerWarnSpy = jest.spyOn(logger, 'warn');
887879

888-
const client = new EppoPrecomputedClient({
880+
new EppoPrecomputedClient({
889881
precomputedFlagStore,
890882
precomputedBanditStore,
891883
subject,
@@ -940,7 +932,7 @@ describe('Precomputed Bandit Store', () => {
940932
},
941933
});
942934

943-
const client = new EppoPrecomputedClient({
935+
new EppoPrecomputedClient({
944936
precomputedFlagStore,
945937
precomputedBanditStore,
946938
subject,
@@ -992,7 +984,7 @@ describe('Precomputed Bandit Store', () => {
992984
},
993985
});
994986

995-
const client = new EppoPrecomputedClient({
987+
new EppoPrecomputedClient({
996988
precomputedFlagStore,
997989
precomputedBanditStore,
998990
subject,
@@ -1023,7 +1015,7 @@ describe('Precomputed Bandit Store', () => {
10231015
},
10241016
});
10251017

1026-
const client = new EppoPrecomputedClient({
1018+
new EppoPrecomputedClient({
10271019
precomputedFlagStore,
10281020
subject,
10291021
});

src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ import EppoPrecomputedClient, {
2424
PrecomputedFlagsRequestParameters,
2525
Subject,
2626
} from './client/eppo-precomputed-client';
27-
import { IConfigurationWire, IPrecomputedConfigurationResponse } from './configuration';
27+
import {
28+
IConfigurationWire,
29+
IObfuscatedPrecomputedConfigurationResponse,
30+
IPrecomputedConfigurationResponse,
31+
} from './configuration';
2832
import FlagConfigRequestor from './configuration-requestor';
2933
import {
3034
IConfigurationStore,
@@ -55,13 +59,17 @@ import {
5559
FormatEnum,
5660
BanditParameters,
5761
BanditVariation,
62+
IObfuscatedPrecomputedBandit,
63+
Variation,
64+
Environment,
5865
} from './interfaces';
5966
import {
6067
AttributeType,
6168
Attributes,
6269
BanditActions,
6370
BanditSubjectAttributes,
6471
ContextAttributes,
72+
FlagKey,
6573
} from './types';
6674
import * as validation from './validation';
6775

@@ -86,6 +94,8 @@ export {
8694
// Precomputed Client
8795
EppoPrecomputedClient,
8896
PrecomputedFlagsRequestParameters,
97+
IObfuscatedPrecomputedConfigurationResponse,
98+
IObfuscatedPrecomputedBandit,
8999

90100
// Configuration store
91101
IConfigurationStore,
@@ -110,6 +120,7 @@ export {
110120
FlagConfigurationRequestParameters,
111121
Flag,
112122
ObfuscatedFlag,
123+
Variation,
113124
VariationType,
114125
AttributeType,
115126
Attributes,
@@ -119,6 +130,7 @@ export {
119130
BanditVariation,
120131
BanditParameters,
121132
Subject,
133+
Environment,
122134
FormatEnum,
123135

124136
// event dispatcher types
@@ -137,6 +149,7 @@ export {
137149
IConfigurationWire,
138150
IPrecomputedConfigurationResponse,
139151
PrecomputedFlag,
152+
FlagKey,
140153

141154
// Test helpers
142155
decodePrecomputedFlag,

0 commit comments

Comments
 (0)