Skip to content

Commit 800d284

Browse files
authored
chore: latest from common, drop isObfuscated calls (#192)
* chore: latest from common dropping isObfuscated calls * fix tests for api endpoints change * 3.14.1
1 parent 8442699 commit 800d284

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

docs/js-client-sdk.getconfigurl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Used to build the URL for fetching the flag configuration.
99
**Signature:**
1010

1111
```typescript
12-
export declare function getConfigUrl(apiKey: string, baseUrl?: string): URL;
12+
export declare function getConfigUrl(apiKey: string, baseUrl?: string): string;
1313
```
1414

1515
## Parameters
@@ -63,7 +63,7 @@ _(Optional)_
6363
</tbody></table>
6464
**Returns:**
6565

66-
URL
66+
string
6767

6868
a URL string
6969

js-client-sdk.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class EppoPrecomputedJSClient extends EppoPrecomputedClient {
121121
export { Flag }
122122

123123
// @public
124-
export function getConfigUrl(apiKey: string, baseUrl?: string): URL;
124+
export function getConfigUrl(apiKey: string, baseUrl?: string): string;
125125

126126
// @public
127127
export function getInstance(): EppoJSClient;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk",
3-
"version": "3.14.0",
3+
"version": "3.14.1",
44
"description": "Eppo SDK for client-side JavaScript applications",
55
"main": "dist/index.js",
66
"files": [
@@ -60,7 +60,7 @@
6060
"webpack-cli": "^6.0.1"
6161
},
6262
"dependencies": {
63-
"@eppo/js-client-sdk-common": "4.14.1"
63+
"@eppo/js-client-sdk-common": "4.14.4"
6464
},
6565
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
6666
}

src/index.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ describe('sync init', () => {
393393
},
394394
});
395395

396+
expect(Object.keys(client.getFlagConfigurations())).toEqual([
397+
'76c488348976aa431acb31f4d752dde8',
398+
]);
396399
expect(client.getStringAssignment(flagKey, 'subject-10', {}, 'default-value')).toEqual(
397400
'variant-1',
398401
);
@@ -1223,20 +1226,20 @@ describe('getConfigUrl function', () => {
12231226

12241227
it('should return a URL using the default base URL when no base URL is provided', () => {
12251228
const url = getConfigUrl(apiKey);
1226-
expect(url.toString()).toContain(defaultBaseUrl);
1227-
expect(url.toString()).not.toContain(customBaseUrl);
1228-
expect(url.toString()).toContain(`apiKey=${apiKey}`);
1229-
expect(url.toString()).toContain('sdkName=');
1230-
expect(url.toString()).toContain('sdkVersion=');
1229+
expect(url).toContain(defaultBaseUrl);
1230+
expect(url).not.toContain(customBaseUrl);
1231+
expect(url).toContain(`apiKey=${apiKey}`);
1232+
expect(url).toContain('sdkName=');
1233+
expect(url).toContain('sdkVersion=');
12311234
});
12321235

12331236
it('should return a URL using the provided base URL', () => {
12341237
const url = getConfigUrl(apiKey, customBaseUrl);
1235-
expect(url.toString()).toContain(customBaseUrl);
1236-
expect(url.toString()).not.toContain(defaultBaseUrl);
1237-
expect(url.toString()).toContain(`apiKey=${apiKey}`);
1238-
expect(url.toString()).toContain('sdkName=');
1239-
expect(url.toString()).toContain('sdkVersion=');
1238+
expect(url).toContain(customBaseUrl);
1239+
expect(url).not.toContain(defaultBaseUrl);
1240+
expect(url).toContain(`apiKey=${apiKey}`);
1241+
expect(url).toContain('sdkName=');
1242+
expect(url).toContain('sdkVersion=');
12401243
});
12411244
});
12421245

src/index.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export class EppoJSClient extends EppoClient {
120120
*/
121121
public static instance = new EppoJSClient({
122122
flagConfigurationStore,
123-
isObfuscated: true,
124123
});
125124

126125
public static initialized = false;
@@ -313,8 +312,6 @@ export class EppoJSClient extends EppoClient {
313312
if (config.banditLogger) {
314313
this.setBanditLogger(config.banditLogger);
315314
}
316-
// Default to obfuscated mode when requesting configuration from the server.
317-
this.setIsObfuscated(true);
318315

319316
const storageKeySuffix = buildStorageKeySuffix(apiKey);
320317

@@ -340,7 +337,6 @@ export class EppoJSClient extends EppoClient {
340337
// We do this because we don't store any metadata in the persistent store and can make the assumption that entries
341338
// in the persistent store are obfuscated since the reason behind obfuscation is to obfuscate any data stored on a
342339
// user device.
343-
this.setIsObfuscated(true); // Use deprecated method to silence warning logs.
344340
configurationStore.setFormat(FormatEnum.CLIENT);
345341
this.setFlagConfigurationStore(configurationStore);
346342

@@ -531,7 +527,13 @@ export class EppoJSClient extends EppoClient {
531527
const memoryOnlyConfigurationStore = configurationStorageFactory({
532528
forceMemoryOnly: true,
533529
});
530+
531+
// Allow the caller to override the default obfuscated mode, which is false
532+
// since the purpose of this method is to bootstrap the SDK from an external source,
533+
// which is likely a server that has not-obfuscated flag values.
534+
// This is the equivalent of setIsObfuscated
534535
memoryOnlyConfigurationStore.setFormat(isObfuscated ? FormatEnum.CLIENT : FormatEnum.SERVER);
536+
535537
memoryOnlyConfigurationStore
536538
.setEntries(config.flagsConfiguration)
537539
.catch((err) =>
@@ -555,11 +557,6 @@ export class EppoJSClient extends EppoClient {
555557
this.unsetOverrideStore();
556558
}
557559

558-
// Allow the caller to override the default obfuscated mode, which is false
559-
// since the purpose of this method is to bootstrap the SDK from an external source,
560-
// which is likely a server that has not-obfuscated flag values.
561-
this.setIsObfuscated(isObfuscated);
562-
563560
if (config.assignmentLogger) {
564561
this.setAssignmentLogger(config.assignmentLogger);
565562
}
@@ -686,7 +683,7 @@ export function getInstance(): EppoJSClient {
686683
* @returns a URL string
687684
* @public
688685
*/
689-
export function getConfigUrl(apiKey: string, baseUrl?: string): URL {
686+
export function getConfigUrl(apiKey: string, baseUrl?: string): string {
690687
const queryParams = { sdkName, sdkVersion, apiKey };
691688
return new ApiEndpoints({ baseUrl, queryParams }).ufcEndpoint();
692689
}

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-
384-
version "4.14.1"
385-
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-4.14.1.tgz#db908420c47a1327921493072892923e58c2039f"
386-
integrity sha512-trXgxPgbS+vFkYd0w0Xb2V9NntE2SgLsThhxoDbRENw1ynb8b8b3MDdwFH+5DheVT1ji6mZ+Qrh40uNIxMptYA==
383+
384+
version "4.14.4"
385+
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-4.14.4.tgz#fd59daa3b9ae385756476bcc1022a53ffcfd8188"
386+
integrity sha512-12JKsYLu+WICH1t9NEgWoxTYc/MyFnZAHhcBJwfcaG0tPIbPfgG9VBT8yTUgBLG8cYZBmDVk7R7SzMGc3vD2eg==
387387
dependencies:
388388
buffer "npm:@eppo/[email protected]"
389389
js-base64 "^3.7.7"

0 commit comments

Comments
 (0)