Skip to content

Commit b328ed9

Browse files
authored
Update SDK to use obfuscated RAC (#32)
* Setup get assignment functions to override the client from common * Add obfuscated rac file to test data * Fix warnings * Update tests cases to match obfuscation * Remove unobfuscated mock rac file
1 parent 77ffcc4 commit b328ed9

14 files changed

+275
-19
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test-data:
3434
rm -rf $(testDataDir)
3535
mkdir -p $(tempDir)
3636
git clone -b ${branchName} --depth 1 --single-branch ${githubRepoLink} ${gitDataDir}
37-
cp ${gitDataDir}rac-experiments-v3.json ${testDataDir}
37+
cp ${gitDataDir}rac-experiments-v3-obfuscated.json ${testDataDir}
3838
cp -r ${gitDataDir}assignment-v2 ${testDataDir}
3939
rm -rf ${tempDir}
4040

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; [getAssignment](./js-client-sdk.eppojsclient.getassignment.md)
4+
5+
## EppoJSClient.getAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
string \| null
25+
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; [getBoolAssignment](./js-client-sdk.eppojsclient.getboolassignment.md)
4+
5+
## EppoJSClient.getBoolAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getBoolAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): boolean | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
boolean \| null
25+
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; [getJSONStringAssignment](./js-client-sdk.eppojsclient.getjsonstringassignment.md)
4+
5+
## EppoJSClient.getJSONStringAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getJSONStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
string \| null
25+
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; [getNumericAssignment](./js-client-sdk.eppojsclient.getnumericassignment.md)
4+
5+
## EppoJSClient.getNumericAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getNumericAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): number | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
number \| null
25+
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; [getParsedJSONAssignment](./js-client-sdk.eppojsclient.getparsedjsonassignment.md)
4+
5+
## EppoJSClient.getParsedJSONAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getParsedJSONAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): object | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
object \| null
25+
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; [getStringAssignment](./js-client-sdk.eppojsclient.getstringassignment.md)
4+
5+
## EppoJSClient.getStringAssignment() method
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
getStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
11+
```
12+
13+
## Parameters
14+
15+
| Parameter | Type | Description |
16+
| --- | --- | --- |
17+
| subjectKey | string | |
18+
| flagKey | string | |
19+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> |
20+
| assignmentHooks | IAssignmentHooks | <i>(Optional)</i> |
21+
22+
<b>Returns:</b>
23+
24+
string \| null
25+

docs/js-client-sdk.eppojsclient.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ export declare class EppoJSClient extends EppoClient
1919
| --- | --- | --- | --- |
2020
| [instance](./js-client-sdk.eppojsclient.instance.md) | <code>static</code> | [EppoJSClient](./js-client-sdk.eppojsclient.md) | |
2121
22+
## Methods
23+
24+
| Method | Modifiers | Description |
25+
| --- | --- | --- |
26+
| [getAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getassignment.md) | | |
27+
| [getBoolAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getboolassignment.md) | | |
28+
| [getJSONStringAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getjsonstringassignment.md) | | |
29+
| [getNumericAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getnumericassignment.md) | | |
30+
| [getParsedJSONAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getparsedjsonassignment.md) | | |
31+
| [getStringAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getstringassignment.md) | | |
32+

js-client-sdk.api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66

77
import { EppoClient } from '@eppo/js-client-sdk-common';
88
import { IAssignmentEvent } from '@eppo/js-client-sdk-common';
9+
import { IAssignmentHooks } from '@eppo/js-client-sdk-common';
910
import { IAssignmentLogger } from '@eppo/js-client-sdk-common';
1011
import { IEppoClient } from '@eppo/js-client-sdk-common';
1112

1213
// @public
1314
export class EppoJSClient extends EppoClient {
15+
// (undocumented)
16+
getAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
17+
// (undocumented)
18+
getBoolAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): boolean | null;
19+
// (undocumented)
20+
getJSONStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
21+
// (undocumented)
22+
getNumericAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): number | null;
23+
// (undocumented)
24+
getParsedJSONAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): object | null;
25+
// (undocumented)
26+
getStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
1427
// (undocumented)
1528
static instance: EppoJSClient;
1629
}

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": "1.2.3",
3+
"version": "1.3.0",
44
"description": "Eppo SDK for client-side JavaScript applications",
55
"main": "dist/index.js",
66
"files": [
@@ -57,7 +57,7 @@
5757
"xhr-mock": "^2.5.1"
5858
},
5959
"dependencies": {
60-
"@eppo/js-client-sdk-common": "^1.5.2",
60+
"@eppo/js-client-sdk-common": "^1.6.0",
6161
"axios": "^0.27.2",
6262
"md5": "^2.3.0"
6363
}

0 commit comments

Comments
 (0)