Skip to content

Commit

Permalink
Use commons 3.0.6; MemoryOnlyConfigurationStore without LRU (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoromanovsky authored May 16, 2024
1 parent c123eed commit 9a34f5e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 79 deletions.
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.0.1",
"version": "3.0.2",
"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.0.2",
"@eppo/js-client-sdk-common": "3.0.6",
"lru-cache": "^10.0.1"
},
"devDependencies": {
Expand Down
32 changes: 0 additions & 32 deletions src/configuration-store.spec.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/configuration-store.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/constants.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ describe('EppoClient E2E test', () => {
});

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

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

it('handles logging exception', () => {
const mockConfigStore = td.object<IConfigurationStore>();
const mockConfigStore = td.object<IConfigurationStore<Flag>>();
td.when(mockConfigStore.get(flagKey)).thenReturn(mockUfcFlagConfig);
const subjectAttributes = { foo: 3 };
const client = new EppoClient(mockConfigStore, requestParamsStub);
Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import {
EppoClient,
IEppoClient,
FlagConfigurationRequestParameters,
MemoryOnlyConfigurationStore,
Flag,
} from '@eppo/js-client-sdk-common';
import { ObfuscatedFlag } from '@eppo/js-client-sdk-common/dist/interfaces';

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


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

const requestConfiguration: FlagConfigurationRequestParameters = {
apiKey: config.apiKey,
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.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.0.2.tgz#c1929fcad1b67676657d721cdc37561da108565d"
integrity sha512-Px7ppXMiWSNYYBRWORLcPSnOSreZASYzvn58CD1ZmKXDIruEOMD/39OUttDHex+tIj26f/BsVZNJzkR4zaD4Lg==
"@eppo/js-client-sdk-common@3.0.6":
version "3.0.6"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.0.6.tgz#8d2019d45708b944e26e493f09bcce833925ffa1"
integrity sha512-YV32rf2UjNuKDAwyEl2HKearxsHRr2UDOJl+xblq5RCG8KB19xjxlNoUeFHd6FwTmqDVFF998r2DDEzoL496YQ==
dependencies:
md5 "^2.3.0"
pino "^8.19.0"
Expand Down

0 comments on commit 9a34f5e

Please sign in to comment.