Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug mode; version of commons 2.1.1-alpha.1 #47

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
tag: alpha
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to merge this, don't check this in

20 changes: 20 additions & 0 deletions docs/js-client-sdk.eppojsclient.dumpstats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[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)

## EppoJSClient.dumpStats() method

> Warning: This API is now obsolete.
>
> temporary method for debugging
>

**Signature:**

```typescript
dumpStats(): any;
```
**Returns:**

any

33 changes: 33 additions & 0 deletions docs/js-client-sdk.eppojsclient.getstringassignmentwithreason.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[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)

## EppoJSClient.getStringAssignmentWithReason() method

> Warning: This API is now obsolete.
>
> temporary method for debugging
>

**Signature:**

```typescript
getStringAssignmentWithReason(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): {
assignment: string | null;
reason: string | null;
};
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| subjectKey | string | |
| flagKey | string | |
| subjectAttributes | Record&lt;string, any&gt; | _(Optional)_ |
| assignmentHooks | IAssignmentHooks | _(Optional)_ |

**Returns:**

{ assignment: string \| null; reason: string \| null; }

2 changes: 2 additions & 0 deletions docs/js-client-sdk.eppojsclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export declare class EppoJSClient extends EppoClient

| Method | Modifiers | Description |
| --- | --- | --- |
| [dumpStats()](./js-client-sdk.eppojsclient.dumpstats.md) | | |
| [getAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getassignment.md) | | |
| [getBoolAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getboolassignment.md) | | |
| [getJSONStringAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getjsonstringassignment.md) | | |
| [getNumericAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getnumericassignment.md) | | |
| [getParsedJSONAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getparsedjsonassignment.md) | | |
| [getStringAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getstringassignment.md) | | |
| [getStringAssignmentWithReason(subjectKey, flagKey, subjectAttributes, assignmentHooks)](./js-client-sdk.eppojsclient.getstringassignmentwithreason.md) | | |

7 changes: 7 additions & 0 deletions js-client-sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { IEppoClient } from '@eppo/js-client-sdk-common';

// @public
export class EppoJSClient extends EppoClient {
// @deprecated (undocumented)
dumpStats(): any;
// (undocumented)
getAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
// (undocumented)
Expand All @@ -24,6 +26,11 @@ export class EppoJSClient extends EppoClient {
getParsedJSONAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): object | null;
// (undocumented)
getStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): string | null;
// @deprecated (undocumented)
getStringAssignmentWithReason(subjectKey: string, flagKey: string, subjectAttributes?: Record<string, any>, assignmentHooks?: IAssignmentHooks): {
assignment: string | null;
reason: string | null;
};
// (undocumented)
static initialized: boolean;
// (undocumented)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk",
"version": "1.6.1",
"version": "1.6.1-alpha.1",
"description": "Eppo SDK for client-side JavaScript applications",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -58,7 +58,7 @@
"xhr-mock": "^2.5.1"
},
"dependencies": {
"@eppo/js-client-sdk-common": "2.1.1",
"@eppo/js-client-sdk-common": "2.1.1-alpha.1",
"md5": "^2.3.0"
}
}
32 changes: 31 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ExperimentConfigurationRequestParameters,
} from '@eppo/js-client-sdk-common';

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

Expand Down Expand Up @@ -79,6 +79,17 @@ export class EppoJSClient extends EppoClient {
public static instance: EppoJSClient = new EppoJSClient(localStorage);
public static initialized = false;

/**
* @deprecated temporary method for debugging
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public dumpStats(): any {
return {
hasWindowLocalStorage: hasWindowLocalStorage(),
pollerStats: EppoJSClient.instance?.pollerStats(),
};
}

public getAssignment(
subjectKey: string,
flagKey: string,
Expand All @@ -90,6 +101,25 @@ export class EppoJSClient extends EppoClient {
return super.getAssignment(subjectKey, flagKey, subjectAttributes, assignmentHooks, true);
}

/**
* @deprecated temporary method for debugging
*/
public getStringAssignmentWithReason(
subjectKey: string,
flagKey: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subjectAttributes?: Record<string, any>,
assignmentHooks?: IAssignmentHooks,
): { assignment: string | null; reason: string | null } {
return super.getStringAssignmentWithReason(
subjectKey,
flagKey,
subjectAttributes,
assignmentHooks,
true,
);
}

public getStringAssignment(
subjectKey: string,
flagKey: string,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==

"@eppo/[email protected]":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-2.1.1.tgz#67e69998702d90d8e927418b31629c614483064c"
integrity sha512-fBFLUgTsTbzjxjxtk9Fcr3lSty02EnLFslzF39gkn5px4mgHQjLW9wwyY0i1E4LNkWsDhaBp52ni60Y7OHB2BA==
"@eppo/[email protected]-alpha.1":
version "2.1.1-alpha.1"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-2.1.1-alpha.1.tgz#cd6862545b808fb0f227068d11b553166113a844"
integrity sha512-mfys6eWvOi/QpCPDw2V4d6noX0FWDAkqw5TtKMzQly5Wmon66fqXc/g9KmNOjsNLo8Pjj6WltCl9g+LxqALgaw==
dependencies:
axios "^1.6.0"
lru-cache "^10.0.1"
Expand Down
Loading