Skip to content

Commit

Permalink
feat: create precomputedInit (#102)
Browse files Browse the repository at this point in the history
* Add tests for precomputed init

* Update js common dependency

* Fix import

* v3.7.1-alpha.0

* Export getPrecomputedInstance method

* Docs updates

* v3.7.1-alpha.1

* v3.8.0
  • Loading branch information
sameerank authored Nov 27, 2024
1 parent 08b97b3 commit ba0a152
Show file tree
Hide file tree
Showing 31 changed files with 584 additions and 167 deletions.
23 changes: 23 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.getbooleanassignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [getBooleanAssignment](./js-client-sdk.eppoprecomputedjsclient.getbooleanassignment.md)

## EppoPrecomputedJSClient.getBooleanAssignment() method

**Signature:**

```typescript
getBooleanAssignment(flagKey: string, defaultValue: boolean): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| flagKey | string | |
| defaultValue | boolean | |

**Returns:**

boolean

23 changes: 23 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.getintegerassignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [getIntegerAssignment](./js-client-sdk.eppoprecomputedjsclient.getintegerassignment.md)

## EppoPrecomputedJSClient.getIntegerAssignment() method

**Signature:**

```typescript
getIntegerAssignment(flagKey: string, defaultValue: number): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| flagKey | string | |
| defaultValue | number | |

**Returns:**

number

23 changes: 23 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.getjsonassignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [getJSONAssignment](./js-client-sdk.eppoprecomputedjsclient.getjsonassignment.md)

## EppoPrecomputedJSClient.getJSONAssignment() method

**Signature:**

```typescript
getJSONAssignment(flagKey: string, defaultValue: object): object;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| flagKey | string | |
| defaultValue | object | |

**Returns:**

object

23 changes: 23 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.getnumericassignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [getNumericAssignment](./js-client-sdk.eppoprecomputedjsclient.getnumericassignment.md)

## EppoPrecomputedJSClient.getNumericAssignment() method

**Signature:**

```typescript
getNumericAssignment(flagKey: string, defaultValue: number): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| flagKey | string | |
| defaultValue | number | |

**Returns:**

number

23 changes: 23 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.getstringassignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [getStringAssignment](./js-client-sdk.eppoprecomputedjsclient.getstringassignment.md)

## EppoPrecomputedJSClient.getStringAssignment() method

**Signature:**

```typescript
getStringAssignment(flagKey: string, defaultValue: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| flagKey | string | |
| defaultValue | string | |

**Returns:**

string

11 changes: 11 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.initialized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [initialized](./js-client-sdk.eppoprecomputedjsclient.initialized.md)

## EppoPrecomputedJSClient.initialized property

**Signature:**

```typescript
static initialized: boolean;
```
11 changes: 11 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) &gt; [instance](./js-client-sdk.eppoprecomputedjsclient.instance.md)

## EppoPrecomputedJSClient.instance property

**Signature:**

```typescript
static instance: EppoPrecomputedJSClient;
```
32 changes: 32 additions & 0 deletions docs/js-client-sdk.eppoprecomputedjsclient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- 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; [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md)

## EppoPrecomputedJSClient class

Client for assigning precomputed experiment variations.

**Signature:**

```typescript
export declare class EppoPrecomputedJSClient extends EppoPrecomputedClient
```
**Extends:** EppoPrecomputedClient
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [initialized](./js-client-sdk.eppoprecomputedjsclient.initialized.md) | <code>static</code> | boolean | |
| [instance](./js-client-sdk.eppoprecomputedjsclient.instance.md) | <code>static</code> | [EppoPrecomputedJSClient](./js-client-sdk.eppoprecomputedjsclient.md) | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [getBooleanAssignment(flagKey, defaultValue)](./js-client-sdk.eppoprecomputedjsclient.getbooleanassignment.md) | | |
| [getIntegerAssignment(flagKey, defaultValue)](./js-client-sdk.eppoprecomputedjsclient.getintegerassignment.md) | | |
| [getJSONAssignment(flagKey, defaultValue)](./js-client-sdk.eppoprecomputedjsclient.getjsonassignment.md) | | |
| [getNumericAssignment(flagKey, defaultValue)](./js-client-sdk.eppoprecomputedjsclient.getnumericassignment.md) | | |
| [getStringAssignment(flagKey, defaultValue)](./js-client-sdk.eppoprecomputedjsclient.getstringassignment.md) | | |
19 changes: 19 additions & 0 deletions docs/js-client-sdk.getprecomputedinstance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- 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; [getPrecomputedInstance](./js-client-sdk.getprecomputedinstance.md)

## getPrecomputedInstance() function

Used to access a singleton SDK precomputed client instance. Use the method after calling precomputedInit() to initialize the client.

**Signature:**

```typescript
export declare function getPrecomputedInstance(): EppoPrecomputedClient;
```
**Returns:**

EppoPrecomputedClient

a singleton precomputed client instance

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.apikey.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.assignmentlogger.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.baseurl.md

This file was deleted.

15 changes: 3 additions & 12 deletions docs/js-client-sdk.iclientconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,22 @@

## IClientConfig interface

Configuration used for initializing the Eppo client
Configuration for regular client initialization

**Signature:**

```typescript
export interface IClientConfig
export interface IClientConfig extends IBaseRequestConfig
```
**Extends:** IBaseRequestConfig
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [apiKey](./js-client-sdk.iclientconfig.apikey.md) | | string | Eppo API key |
| [assignmentLogger](./js-client-sdk.iclientconfig.assignmentlogger.md) | | IAssignmentLogger | Pass a logging implementation to send variation assignments to your data warehouse. |
| [baseUrl?](./js-client-sdk.iclientconfig.baseurl.md) | | string | _(Optional)_ Base URL of the Eppo API. Clients should use the default setting in most cases. |
| [forceReinitialize?](./js-client-sdk.iclientconfig.forcereinitialize.md) | | boolean | _(Optional)_ Force reinitialize the SDK if it is already initialized. |
| [maxCacheAgeSeconds?](./js-client-sdk.iclientconfig.maxcacheageseconds.md) | | number | _(Optional)_ Maximum age, in seconds, previously cached values are considered valid until new values will be fetched (default: 0) |
| [numInitialRequestRetries?](./js-client-sdk.iclientconfig.numinitialrequestretries.md) | | number | _(Optional)_ Number of additional times the initial configuration request will be attempted if it fails. This is the request typically synchronously waited (via await) for completion. A small wait will be done between requests. (Default: 1) |
| [numPollRequestRetries?](./js-client-sdk.iclientconfig.numpollrequestretries.md) | | number | _(Optional)_ Number of additional times polling for updated configurations will be attempted before giving up. Polling is done after a successful initial request. Subsequent attempts are done using an exponential backoff. (Default: 7) |
| [persistentStore?](./js-client-sdk.iclientconfig.persistentstore.md) | | IAsyncStore&lt;Flag&gt; | _(Optional)_ A custom class to use for storing flag configurations. This is useful for cases where you want to use a different storage mechanism than the default storage provided by the SDK. |
| [pollAfterFailedInitialization?](./js-client-sdk.iclientconfig.pollafterfailedinitialization.md) | | boolean | _(Optional)_ Poll for new configurations even if the initial configuration request failed. (default: false) |
| [pollAfterSuccessfulInitialization?](./js-client-sdk.iclientconfig.pollaftersuccessfulinitialization.md) | | boolean | _(Optional)_ Poll for new configurations (every <code>pollingIntervalMs</code>) after successfully requesting the initial configuration. (default: false) |
| [pollingIntervalMs?](./js-client-sdk.iclientconfig.pollingintervalms.md) | | number | _(Optional)_ Amount of time to wait between API calls to refresh configuration data. Default of 30\_000 (30 seconds). |
| [requestTimeoutMs?](./js-client-sdk.iclientconfig.requesttimeoutms.md) | | number | _(Optional)_ \* Timeout in milliseconds for the HTTPS request for the experiment configuration. (Default: 5000) |
| [skipInitialRequest?](./js-client-sdk.iclientconfig.skipinitialrequest.md) | | boolean | _(Optional)_ Skip the request for new configurations during initialization. (default: false) |
| [throwOnFailedInitialization?](./js-client-sdk.iclientconfig.throwonfailedinitialization.md) | | boolean | _(Optional)_ Throw an error if unable to fetch an initial configuration during initialization. (default: true) |
| [updateOnFetch?](./js-client-sdk.iclientconfig.updateonfetch.md) | | ServingStoreUpdateStrategy | _(Optional)_ Sets how the configuration is updated after a successful fetch - always: immediately start using the new configuration - expired: immediately start using the new configuration only if the current one has expired - empty: only use the new configuration if the current one is both expired and uninitialized/empty |
| [useExpiredCache?](./js-client-sdk.iclientconfig.useexpiredcache.md) | | boolean | _(Optional)_ Whether initialization will be considered successfully complete if expired cache values are loaded. If false, initialization will always wait for a fetch if cached values are expired. (default: false) |
Expand Down
13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.numinitialrequestretries.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.numpollrequestretries.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.pollafterfailedinitialization.md

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.pollingintervalms.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.requesttimeoutms.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/js-client-sdk.iclientconfig.skipinitialrequest.md

This file was deleted.

22 changes: 22 additions & 0 deletions docs/js-client-sdk.iprecomputedclientconfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- 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; [IPrecomputedClientConfig](./js-client-sdk.iprecomputedclientconfig.md)

## IPrecomputedClientConfig interface

Configuration for Eppo precomputed client initialization

**Signature:**

```typescript
export interface IPrecomputedClientConfig extends IBaseRequestConfig
```
**Extends:** IBaseRequestConfig
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [subjectAttributes?](./js-client-sdk.iprecomputedclientconfig.subjectattributes.md) | | Record&lt;string, AttributeType&gt; | _(Optional)_ Subject attributes to use for precomputed flag assignments. |
| [subjectKey](./js-client-sdk.iprecomputedclientconfig.subjectkey.md) | | string | Subject key to use for precomputed flag assignments. |
Loading

0 comments on commit ba0a152

Please sign in to comment.