diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ed9d88e..b9b5f03 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,3 +17,4 @@ jobs: with: token: ${{ secrets.NPM_TOKEN }} access: public + tag: alpha diff --git a/docs/js-client-sdk.eppojsclient.dumpstats.md b/docs/js-client-sdk.eppojsclient.dumpstats.md new file mode 100644 index 0000000..65c7738 --- /dev/null +++ b/docs/js-client-sdk.eppojsclient.dumpstats.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@eppo/js-client-sdk](./js-client-sdk.md) > [EppoJSClient](./js-client-sdk.eppojsclient.md) > [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 + diff --git a/docs/js-client-sdk.eppojsclient.getstringassignmentwithreason.md b/docs/js-client-sdk.eppojsclient.getstringassignmentwithreason.md new file mode 100644 index 0000000..8038b5d --- /dev/null +++ b/docs/js-client-sdk.eppojsclient.getstringassignmentwithreason.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [@eppo/js-client-sdk](./js-client-sdk.md) > [EppoJSClient](./js-client-sdk.eppojsclient.md) > [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, assignmentHooks?: IAssignmentHooks): { + assignment: string | null; + reason: string | null; + }; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| subjectKey | string | | +| flagKey | string | | +| subjectAttributes | Record<string, any> | _(Optional)_ | +| assignmentHooks | IAssignmentHooks | _(Optional)_ | + +**Returns:** + +{ assignment: string \| null; reason: string \| null; } + diff --git a/docs/js-client-sdk.eppojsclient.md b/docs/js-client-sdk.eppojsclient.md index 673ad5d..f2ada5f 100644 --- a/docs/js-client-sdk.eppojsclient.md +++ b/docs/js-client-sdk.eppojsclient.md @@ -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) | | | diff --git a/js-client-sdk.api.md b/js-client-sdk.api.md index 93bfe14..13b638a 100644 --- a/js-client-sdk.api.md +++ b/js-client-sdk.api.md @@ -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, assignmentHooks?: IAssignmentHooks): string | null; // (undocumented) @@ -24,6 +26,11 @@ export class EppoJSClient extends EppoClient { getParsedJSONAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record, assignmentHooks?: IAssignmentHooks): object | null; // (undocumented) getStringAssignment(subjectKey: string, flagKey: string, subjectAttributes?: Record, assignmentHooks?: IAssignmentHooks): string | null; + // @deprecated (undocumented) + getStringAssignmentWithReason(subjectKey: string, flagKey: string, subjectAttributes?: Record, assignmentHooks?: IAssignmentHooks): { + assignment: string | null; + reason: string | null; + }; // (undocumented) static initialized: boolean; // (undocumented) diff --git a/package.json b/package.json index 8b75e34..51c4a05 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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" } } diff --git a/src/index.ts b/src/index.ts index d66fe95..aba7058 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; @@ -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, @@ -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, + assignmentHooks?: IAssignmentHooks, + ): { assignment: string | null; reason: string | null } { + return super.getStringAssignmentWithReason( + subjectKey, + flagKey, + subjectAttributes, + assignmentHooks, + true, + ); + } + public getStringAssignment( subjectKey: string, flagKey: string, diff --git a/yarn.lock b/yarn.lock index 464e8cc..a205f82 100644 --- a/yarn.lock +++ b/yarn.lock @@ -380,10 +380,10 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@eppo/js-client-sdk-common@2.1.1": - 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/js-client-sdk-common@2.1.1-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"