Skip to content

Commit 9a34f5e

Browse files
Use commons 3.0.6; MemoryOnlyConfigurationStore without LRU (#59)
1 parent c123eed commit 9a34f5e

File tree

7 files changed

+14
-79
lines changed

7 files changed

+14
-79
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/node-server-sdk",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Eppo node server SDK",
55
"main": "dist/index.js",
66
"files": [
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Eppo-exp/node-server-sdk#readme",
3131
"dependencies": {
32-
"@eppo/js-client-sdk-common": "3.0.2",
32+
"@eppo/js-client-sdk-common": "3.0.6",
3333
"lru-cache": "^10.0.1"
3434
},
3535
"devDependencies": {

src/configuration-store.spec.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/configuration-store.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/constants.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/index.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ describe('EppoClient E2E test', () => {
175175
});
176176

177177
it('returns the default value when ufc config is absent', () => {
178-
const mockConfigStore = td.object<IConfigurationStore>();
178+
const mockConfigStore = td.object<IConfigurationStore<Flag>>();
179179
td.when(mockConfigStore.get(flagKey)).thenReturn(null);
180180
const client = new EppoClient(mockConfigStore, requestParamsStub);
181181
const assignment = client.getStringAssignment(flagKey, 'subject-10', {}, 'default-value');
182182
expect(assignment).toEqual('default-value');
183183
});
184184

185185
it('logs variation assignment and experiment key', () => {
186-
const mockConfigStore = td.object<IConfigurationStore>();
186+
const mockConfigStore = td.object<IConfigurationStore<Flag>>();
187187
td.when(mockConfigStore.get(flagKey)).thenReturn(mockUfcFlagConfig);
188188
const subjectAttributes = { foo: 3 };
189189
const client = new EppoClient(mockConfigStore, requestParamsStub);
@@ -208,7 +208,7 @@ describe('EppoClient E2E test', () => {
208208
});
209209

210210
it('handles logging exception', () => {
211-
const mockConfigStore = td.object<IConfigurationStore>();
211+
const mockConfigStore = td.object<IConfigurationStore<Flag>>();
212212
td.when(mockConfigStore.get(flagKey)).thenReturn(mockUfcFlagConfig);
213213
const subjectAttributes = { foo: 3 };
214214
const client = new EppoClient(mockConfigStore, requestParamsStub);

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import {
44
EppoClient,
55
IEppoClient,
66
FlagConfigurationRequestParameters,
7+
MemoryOnlyConfigurationStore,
8+
Flag,
79
} from '@eppo/js-client-sdk-common';
10+
import { ObfuscatedFlag } from '@eppo/js-client-sdk-common/dist/interfaces';
811

9-
import { InMemoryConfigurationStore } from './configuration-store';
10-
import { MAX_CACHE_ENTRIES } from './constants';
1112
import { sdkName, sdkVersion } from './sdk-data';
1213

14+
1315
/**
1416
* Configuration used for initializing the Eppo client
1517
* @public
@@ -74,7 +76,7 @@ let clientInstance: IEppoClient;
7476
*/
7577
export async function init(config: IClientConfig): Promise<IEppoClient> {
7678
validation.validateNotBlank(config.apiKey, 'API key required');
77-
const configurationStore = new InMemoryConfigurationStore(MAX_CACHE_ENTRIES);
79+
const configurationStore = new MemoryOnlyConfigurationStore<Flag | ObfuscatedFlag>();
7880

7981
const requestConfiguration: FlagConfigurationRequestParameters = {
8082
apiKey: config.apiKey,

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@
460460
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
461461
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
462462

463-
464-
version "3.0.2"
465-
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.0.2.tgz#c1929fcad1b67676657d721cdc37561da108565d"
466-
integrity sha512-Px7ppXMiWSNYYBRWORLcPSnOSreZASYzvn58CD1ZmKXDIruEOMD/39OUttDHex+tIj26f/BsVZNJzkR4zaD4Lg==
463+
464+
version "3.0.6"
465+
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.0.6.tgz#8d2019d45708b944e26e493f09bcce833925ffa1"
466+
integrity sha512-YV32rf2UjNuKDAwyEl2HKearxsHRr2UDOJl+xblq5RCG8KB19xjxlNoUeFHd6FwTmqDVFF998r2DDEzoL496YQ==
467467
dependencies:
468468
md5 "^2.3.0"
469469
pino "^8.19.0"

0 commit comments

Comments
 (0)