Skip to content

Commit e4ce319

Browse files
authored
Bump common version to allow handling of special characters (#135)
* bump common version * linter fixes * update test to have valid batch size * remove now unused import * feedback from PR
1 parent d61b2fb commit e4ce319

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"webpack-cli": "^6.0.1"
6060
},
6161
"dependencies": {
62-
"@eppo/js-client-sdk-common": "^4.6.3"
62+
"@eppo/js-client-sdk-common": "^4.7.1"
6363
},
6464
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
6565
}

src/events/local-storage-backed-named-event-queue.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export default class LocalStorageBackedNamedEventQueue<T> implements NamedEventQ
4747
if (this.eventKeys.length === 0) {
4848
return undefined;
4949
}
50-
const eventKey = this.eventKeys.shift()!;
50+
const eventKey = this.eventKeys.shift();
51+
if (!eventKey) {
52+
throw new Error('Unexpected undefined event key');
53+
}
5154
const eventData = localStorage.getItem(eventKey);
5255
if (eventData) {
5356
localStorage.removeItem(eventKey);

src/i-client-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { AttributeType, Flag, IAssignmentLogger, IAsyncStore } from '@eppo/js-client-sdk-common';
2-
import { EventDispatcherConfig } from '@eppo/js-client-sdk-common/src/events/default-event-dispatcher';
32

43
import { ServingStoreUpdateStrategy } from './isolatable-hybrid.store';
54

src/index.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { IClientConfig } from './i-client-config';
2929
import { ServingStoreUpdateStrategy } from './isolatable-hybrid.store';
3030

3131
import {
32-
EppoJSClient,
3332
EppoPrecomputedJSClient,
3433
getConfigUrl,
3534
getInstance,
@@ -1188,24 +1187,24 @@ describe('EppoClient config', () => {
11881187
json: () => Promise.resolve({}),
11891188
});
11901189
}) as jest.Mock;
1191-
EppoJSClient.initialized = false;
11921190
const client = await init({
1191+
forceReinitialize: true,
11931192
apiKey: 'zCsQuoHJxVPp895.ZWg9MTIzNDU2LmUudGVzdGluZy5lcHBvLmNsb3Vk',
11941193
assignmentLogger: td.object<IAssignmentLogger>(),
11951194
eventIngestionConfig: {
11961195
deliveryIntervalMs: 1,
11971196
retryIntervalMs: 2,
11981197
maxRetryDelayMs: 3,
11991198
maxRetries: 4,
1200-
batchSize: 5,
1199+
batchSize: 500,
12011200
},
12021201
});
12031202
// hack to read the private class members config
12041203
const eventDispatcher = client['eventDispatcher'];
12051204
const retryManager = eventDispatcher['retryManager'];
12061205
const batchProcessor = eventDispatcher['batchProcessor'];
12071206
expect(eventDispatcher['deliveryIntervalMs']).toEqual(1);
1208-
expect(batchProcessor['batchSize']).toEqual(5);
1207+
expect(batchProcessor['batchSize']).toEqual(500);
12091208
expect(retryManager['config']['retryIntervalMs']).toEqual(2);
12101209
expect(retryManager['config']['maxRetryDelayMs']).toEqual(3);
12111210
expect(retryManager['config']['maxRetries']).toEqual(4);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ export async function init(config: IClientConfig): Promise<EppoClient> {
465465
// both failed, make the "fatal" error the fetch one
466466
initializationError = initFromFetchError;
467467
}
468-
} catch (error: any) {
469-
initializationError = error;
468+
} catch (error: unknown) {
469+
initializationError = error instanceof Error ? error : new Error(String(error));
470470
}
471471

472472
if (initializationError) {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@
380380
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz#f13c7c205915eb91ae54c557f5e92bddd8be0e83"
381381
integrity sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==
382382

383-
"@eppo/js-client-sdk-common@^4.6.3":
384-
version "4.6.3"
385-
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-4.6.3.tgz#89267a1c247bc04725b7701cdfb573613c133ddc"
386-
integrity sha512-e2nSvzONjqUiAYUjBMIIk1jWuKPOmBl5AlbiNjsoJAd6dZKN1RWpTmy83hNk6ff/syjAEWTcplls2cU37VbyiQ==
383+
"@eppo/js-client-sdk-common@^4.7.1":
384+
version "4.7.1"
385+
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-4.7.1.tgz#8a0776055604af65d0e0f8410d4756aa3117992f"
386+
integrity sha512-8+5WbFN1EvsS5Ba/qakjDGEhp9loTxSvVHeWaQXKKLXxV+5AhFNOl+d8jSwOkLnP+Qr5D9w1eO7lfzuNDkUcWw==
387387
dependencies:
388388
buffer "npm:@eppo/[email protected]"
389389
js-base64 "^3.7.7"

0 commit comments

Comments
 (0)