Skip to content

Commit 9064661

Browse files
committed
use commons 2.1.1-alpha.0
1 parent f742feb commit 9064661

9 files changed

+89
-8
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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; [\_getStringAssignmentWithReason](./js-client-sdk.eppojsclient._getstringassignmentwithreason.md)
4+
5+
## EppoJSClient.\_getStringAssignmentWithReason() method
6+
7+
**Signature:**
8+
9+
```typescript
10+
_getStringAssignmentWithReason(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): {
11+
assignment: string | null;
12+
reason: string | null;
13+
};
14+
```
15+
16+
## Parameters
17+
18+
| Parameter | Type | Description |
19+
| --- | --- | --- |
20+
| subjectKey | string | |
21+
| flagKey | string | |
22+
| subjectAttributes | Record&lt;string, any&gt; | _(Optional)_ |
23+
| assignmentHooks | IAssignmentHooks | _(Optional)_ |
24+
25+
**Returns:**
26+
27+
{ assignment: string \| null; reason: string \| null; }
28+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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; [dumpStats](./js-client-sdk.eppojsclient.dumpstats.md)
4+
5+
## EppoJSClient.dumpStats() method
6+
7+
**Signature:**
8+
9+
```typescript
10+
dumpStats(): any;
11+
```
12+
**Returns:**
13+
14+
any
15+

docs/js-client-sdk.eppojsclient.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export declare class EppoJSClient extends EppoClient
2323
2424
| Method | Modifiers | Description |
2525
| --- | --- | --- |
26+
| [\_getStringAssignmentWithReason(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient._getstringassignmentwithreason.md) | | |
27+
| [dumpStats()](./js-client-sdk.eppojsclient.dumpstats.md) | | |
2628
| [getAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getassignment.md) | | |
2729
| [getBoolAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getboolassignment.md) | | |
2830
| [getJSONStringAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getjsonstringassignment.md) | | |

docs/js-client-sdk.iclientconfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export interface IClientConfig
2424
| [pollAfterFailedInitialization?](./js-client-sdk.iclientconfig.pollafterfailedinitialization.md) | | boolean | _(Optional)_ Poll for new configurations even if the initial configuration request failed. (default: false) |
2525
| [pollAfterSuccessfulInitialization?](./js-client-sdk.iclientconfig.pollaftersuccessfulinitialization.md) | | boolean | _(Optional)_ Poll for new configurations (every 30 seconds) after successfully requesting the initial configuration. (default: false) |
2626
| [requestTimeoutMs?](./js-client-sdk.iclientconfig.requesttimeoutms.md) | | number | _(Optional)_ \* Timeout in milliseconds for the HTTPS request for the experiment configuration. (Default: 5000) |
27-
| [throwOnFailedInitialization?](./js-client-sdk.iclientconfig.throwonfailedinitialization.md) | | boolean | _(Optional)_ Throw on error if unable to fetch an initial configuration during initialization. (default: true) |
27+
| [throwOnFailedInitialization?](./js-client-sdk.iclientconfig.throwonfailedinitialization.md) | | boolean | _(Optional)_ Throw an error if unable to fetch an initial configuration during initialization. (default: true) |
2828

docs/js-client-sdk.iclientconfig.throwonfailedinitialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## IClientConfig.throwOnFailedInitialization property
66

7-
Throw on error if unable to fetch an initial configuration during initialization. (default: true)
7+
Throw an error if unable to fetch an initial configuration during initialization. (default: true)
88

99
**Signature:**
1010

js-client-sdk.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { IEppoClient } from '@eppo/js-client-sdk-common';
1212

1313
// @public
1414
export class EppoJSClient extends EppoClient {
15+
// (undocumented)
16+
dumpStats(): any;
1517
// (undocumented)
1618
getAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
1719
// (undocumented)
@@ -25,6 +27,11 @@ export class EppoJSClient extends EppoClient {
2527
// (undocumented)
2628
getStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
2729
// (undocumented)
30+
_getStringAssignmentWithReason(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): {
31+
assignment: string | null;
32+
reason: string | null;
33+
};
34+
// (undocumented)
2835
static instance: EppoJSClient;
2936
}
3037

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"xhr-mock": "^2.5.1"
5959
},
6060
"dependencies": {
61-
"@eppo/js-client-sdk-common": "2.1.0",
61+
"@eppo/js-client-sdk-common": "file:../js-client-sdk-common",
6262
"md5": "^2.3.0"
6363
}
6464
}

src/index.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ExperimentConfigurationRequestParameters,
88
} from '@eppo/js-client-sdk-common';
99

10-
import { EppoLocalStorage } from './local-storage';
10+
import { EppoLocalStorage, hasWindowLocalStorage } from './local-storage';
1111
import { LocalStorageAssignmentCache } from './local-storage-assignment-cache';
1212
import { sdkName, sdkVersion } from './sdk-data';
1313

@@ -76,6 +76,14 @@ export { IAssignmentLogger, IAssignmentEvent, IEppoClient } from '@eppo/js-clien
7676
export class EppoJSClient extends EppoClient {
7777
public static instance: EppoJSClient;
7878

79+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
80+
public dumpStats(): any {
81+
return {
82+
hasWindowLocalStorage: hasWindowLocalStorage(),
83+
pollerStats: EppoJSClient.instance?._pollerStats(),
84+
};
85+
}
86+
7987
public getAssignment(
8088
subjectKey: string,
8189
flagKey: string,
@@ -86,6 +94,22 @@ export class EppoJSClient extends EppoClient {
8694
return super.getAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks, true);
8795
}
8896

97+
public _getStringAssignmentWithReason(
98+
subjectKey: string,
99+
flagKey: string,
100+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
101+
subjectAttributes?: Record<string, any>,
102+
assignmentHooks?: IAssignmentHooks,
103+
): { assignment: string | null; reason: string | null } {
104+
return super._getStringAssignmentWithReason(
105+
subjectKey,
106+
flagKey,
107+
subjectAttributes,
108+
assignmentHooks,
109+
true,
110+
);
111+
}
112+
89113
public getStringAssignment(
90114
subjectKey: string,
91115
flagKey: string,

yarn.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,20 @@
380380
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
381381
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
382382

383-
384-
version "2.1.0"
385-
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-2.1.0.tgz#491016d969b4dbca7f0101eda2146493eb6670d5"
386-
integrity sha512-oORik7V/+8IitINavwRB6crEDC2k6LjjIqUDn9olMgr3zZsTEHsnPfTzbAkSRhWt0MT9lhjKAmjHubb/eRQ7+A==
383+
"@eppo/js-client-sdk-common@file:../js-client-sdk-common":
384+
version "2.1.1-alpha"
387385
dependencies:
388386
axios "^1.6.0"
389387
lru-cache "^10.0.1"
390388
md5 "^2.3.0"
391389

390+
"@eppo/js-client-sdk@file:.":
391+
version "1.6.0"
392+
dependencies:
393+
"@eppo/js-client-sdk" "file:../../Library/Caches/Yarn/v6/npm-@eppo-js-client-sdk-1.6.0-b600ca25-0def-49d6-9218-f5b4a9210a82-1706827426878/node_modules/@eppo/js-client-sdk"
394+
"@eppo/js-client-sdk-common" "file:../../Library/Caches/Yarn/v6/npm-@eppo-js-client-sdk-1.6.0-b600ca25-0def-49d6-9218-f5b4a9210a82-1706827426878/node_modules/@eppo/js-client-sdk-common"
395+
md5 "^2.3.0"
396+
392397
"@eslint/eslintrc@^1.3.0":
393398
version "1.3.0"
394399
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f"

0 commit comments

Comments
 (0)