Skip to content

Commit 61475b0

Browse files
authored
chore: Bump js-client-sdk-common dep to pick up new getBooleanAssignment API (#77)
* chore: Bump js-client-sdk-common to pick up new `getBooleanAssignment` API * version bump * Call correct super method
1 parent 2838ffb commit 61475b0

File tree

8 files changed

+59
-12
lines changed

8 files changed

+59
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ yarn-error.log
1010
test/data
1111

1212
.eslintcache
13+
14+
# IntelliJ generated files
15+
.idea/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
## Installation
1919

20-
```javascript
20+
```bash
2121
npm install @eppo/js-client-sdk
2222
```
2323

@@ -53,7 +53,7 @@ const variation = eppoClient.getBooleanAssignment('show-new-feature', user.id, {
5353
Every Eppo flag has a return type that is set once on creation in the dashboard. Once a flag is created, assignments in code should be made using the corresponding typed function:
5454

5555
```javascript
56-
getBoolAssignment(...)
56+
getBooleanAssignment(...)
5757
getNumericAssignment(...)
5858
getIntegerAssignment(...)
5959
getStringAssignment(...)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [EppoJSClient](./js-client-sdk.eppojsclient.md) &gt; [getBooleanAssignment](./js-client-sdk.eppojsclient.getbooleanassignment.md)
4+
5+
## EppoJSClient.getBooleanAssignment() method
6+
7+
**Signature:**
8+
9+
```typescript
10+
getBooleanAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, any>, defaultValue: boolean): boolean;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| flagKey | string | |
18+
| subjectKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | |
20+
| defaultValue | boolean | |
21+
22+
**Returns:**
23+
24+
boolean
25+

docs/js-client-sdk.eppojsclient.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export declare class EppoJSClient extends EppoClient
2525
| Method | Modifiers | Description |
2626
| --- | --- | --- |
2727
| [getBoolAssignment(flagKey, subjectKey, subjectAttributes, defaultValue)](./js-client-sdk.eppojsclient.getboolassignment.md) | | |
28+
| [getBooleanAssignment(flagKey, subjectKey, subjectAttributes, defaultValue)](./js-client-sdk.eppojsclient.getbooleanassignment.md) | | |
2829
| [getIntegerAssignment(flagKey, subjectKey, subjectAttributes, defaultValue)](./js-client-sdk.eppojsclient.getintegerassignment.md) | | |
2930
| [getJSONAssignment(flagKey, subjectKey, subjectAttributes, defaultValue)](./js-client-sdk.eppojsclient.getjsonassignment.md) | | |
3031
| [getNumericAssignment(flagKey, subjectKey, subjectAttributes, defaultValue)](./js-client-sdk.eppojsclient.getnumericassignment.md) | | |

js-client-sdk.api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export class EppoJSClient extends EppoClient {
3131
// (undocumented)
3232
getBoolAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, any>, defaultValue: boolean): boolean;
3333
// (undocumented)
34+
getBooleanAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, any>, defaultValue: boolean): boolean;
35+
// (undocumented)
3436
getIntegerAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, any>, defaultValue: number): number;
3537
// (undocumented)
3638
getJSONAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, any>, defaultValue: object): object;
@@ -51,6 +53,8 @@ export { IAssignmentEvent }
5153

5254
export { IAssignmentLogger }
5355

56+
export { IAsyncStore }
57+
5458
// @public
5559
export interface IClientConfig {
5660
apiKey: string;

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk",
3-
"version": "3.0.2",
3+
"version": "3.1.0",
44
"description": "Eppo SDK for client-side JavaScript applications",
55
"main": "dist/index.js",
66
"files": [
@@ -58,7 +58,7 @@
5858
"webpack-cli": "^4.10.0"
5959
},
6060
"dependencies": {
61-
"@eppo/js-client-sdk-common": "3.0.8",
61+
"@eppo/js-client-sdk-common": "3.1.0",
6262
"md5": "^2.3.0"
6363
}
64-
}
64+
}

src/index.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ export {
9494
export { ChromeStorageAsyncStore } from './chrome.configuration-store';
9595

9696
// Instantiate the configuration store with memory-only implementation.
97-
const configurationStore = configurationStorageFactory({ forceMemoryOnly: true });
97+
const configurationStore = configurationStorageFactory({
98+
forceMemoryOnly: true,
99+
});
98100

99101
/**
100102
* Client for assigning experiment variations.
@@ -117,14 +119,26 @@ export class EppoJSClient extends EppoClient {
117119
return super.getStringAssignment(flagKey, subjectKey, subjectAttributes, defaultValue);
118120
}
119121

122+
/**
123+
* @deprecated Use getBooleanAssignment instead
124+
*/
120125
public getBoolAssignment(
121126
flagKey: string,
122127
subjectKey: string,
123128
subjectAttributes: Record<string, any>,
124129
defaultValue: boolean,
130+
): boolean {
131+
return this.getBooleanAssignment(flagKey, subjectKey, subjectAttributes, defaultValue);
132+
}
133+
134+
public getBooleanAssignment(
135+
flagKey: string,
136+
subjectKey: string,
137+
subjectAttributes: Record<string, any>,
138+
defaultValue: boolean,
125139
): boolean {
126140
EppoJSClient.getAssignmentInitializationCheck();
127-
return super.getBoolAssignment(flagKey, subjectKey, subjectAttributes, defaultValue);
141+
return super.getBooleanAssignment(flagKey, subjectKey, subjectAttributes, defaultValue);
128142
}
129143

130144
public getIntegerAssignment(
@@ -179,7 +193,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
179193
}
180194

181195
// Set the configuration store to the desired persistent store, if provided.
182-
// Otherwise the factory method will detect the current environment and instantiate the correct store.
196+
// Otherwise, the factory method will detect the current environment and instantiate the correct store.
183197
const configurationStore = configurationStorageFactory(
184198
{
185199
persistentStore: config.persistentStore,

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.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
381381
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
382382

383-
"@eppo/js-client-sdk-common@3.0.8":
384-
version "3.0.8"
385-
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.0.8.tgz#738c67c2ae95d4c8b8b84cd8625ff010e11ac6cc"
386-
integrity sha512-Qe7O78Pt2PYyTXMLYQMoGyv0aOu5NdXsO1VWBCjA6aUqkWKyy4etyMy1BXpwsbxH6kvKq1uwTJO19N7zoCVFlQ==
383+
"@eppo/js-client-sdk-common@3.1.0":
384+
version "3.1.0"
385+
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-3.1.0.tgz#3958fa591d8e5b4026b1e58de86eb9865a2751e7"
386+
integrity sha512-r/zHyE60QlIBEq91o/0PQud0fbLKqN1s8FDvN9OWjYEJx8XAUyYAx+rivAGycxwqU76TV1y8EUCOMFYvAVR1Jg==
387387
dependencies:
388388
md5 "^2.3.0"
389389
pino "^8.19.0"

0 commit comments

Comments
 (0)