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

feat: create offlinePrecomputedInit #117

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ecf184d
Create offlinePrecomputedInit method
sameerank Dec 5, 2024
80340ca
Adjust config init format to have a precompute object
sameerank Dec 9, 2024
ce4bf21
v3.9.0
sameerank Dec 9, 2024
3fdd774
Bump minor version
sameerank Dec 9, 2024
2cbe3e5
Test for offlinePrecomputedInit
sameerank Dec 9, 2024
acbafaa
Fix tests
sameerank Dec 9, 2024
e3f35a5
Update common version
sameerank Dec 10, 2024
b0f73a7
Docs update
sameerank Dec 10, 2024
723728b
Merge branch 'main' into sameeran/ff-3649-offline-init-method-for-pre…
sameerank Dec 11, 2024
90d725e
Update offline precomputed init to use the configuration wire format
sameerank Dec 11, 2024
c8c6a55
Remove unused IPrecompute import
sameerank Dec 11, 2024
9216ca7
Add a todo comment
sameerank Dec 11, 2024
8b3f8c4
Delete ds store
sameerank Dec 11, 2024
409019a
Merge branch 'main' into sameeran/ff-3649-offline-init-method-for-pre…
sameerank Dec 16, 2024
c625655
Update paths to test files
sameerank Dec 16, 2024
82ca8ba
Change test data branch back to main
sameerank Dec 16, 2024
265bdd9
Fix tests
sameerank Dec 16, 2024
6f32a79
Change test data branch back to main
sameerank Dec 16, 2024
9b4e404
v3.9.0
sameerank Dec 16, 2024
c2f0c78
v3.9.0-alpha.0
sameerank Dec 16, 2024
ee3409f
Update lock file
sameerank Dec 16, 2024
3410428
Merge branch 'main' into sameeran/ff-3649-offline-init-method-for-pre…
sameerank Jan 8, 2025
3320634
Update to use constructor instead of setters
sameerank Jan 8, 2025
f31efd8
Update js sdk common dependency
sameerank Jan 8, 2025
3f5a2bb
Update common sdk dependency to 4.8.0-alpha.1
sameerank Jan 10, 2025
5f24951
Comply with throwOnFailedInitialization
sameerank Jan 10, 2025
72c6ac3
Remove unneeded reset the static instance before each test
sameerank Jan 10, 2025
5c3712e
Make documentation consistent with the interface
sameerank Jan 10, 2025
d71e589
Remove unnecessary casting to Attribute
sameerank Jan 10, 2025
e094f8e
Don't include logger prefix in thrown error
sameerank Jan 10, 2025
27b413b
Add a shutdown function and test
sameerank Jan 10, 2025
70a0667
Remove comment
sameerank Jan 10, 2025
a2db546
v3.9.2-alpha.0
sameerank Jan 11, 2025
a53962d
Remove application logger input
sameerank Jan 11, 2025
8612f58
Fix test
sameerank Jan 11, 2025
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test-data:
mkdir -p $(tempDir)
git clone -b ${branchName} --depth 1 --single-branch ${githubRepoLink} ${gitDataDir}
cp -r ${gitDataDir}ufc ${testDataDir}
cp -r ${gitDataDir}configuration-wire ${testDataDir}
rm -rf ${tempDir}

## prepare
Expand All @@ -49,4 +50,4 @@ prepare: test-data
## test
.PHONY: test
test: test test-data
yarn test:unit
yarn test:unit
1 change: 1 addition & 0 deletions docs/js-client-sdk.iclientconfig.eventingestionconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ eventIngestionConfig?: {
maxRetryDelayMs?: number;
maxRetries?: number;
batchSize?: number;
maxQueueSize?: number;
sameerank marked this conversation as resolved.
Show resolved Hide resolved
};
```
2 changes: 1 addition & 1 deletion docs/js-client-sdk.iclientconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Description

</td><td>

{ deliveryIntervalMs?: number; retryIntervalMs?: number; maxRetryDelayMs?: number; maxRetries?: number; batchSize?: number; }
{ deliveryIntervalMs?: number; retryIntervalMs?: number; maxRetryDelayMs?: number; maxRetries?: number; batchSize?: number; maxQueueSize?: number; }


</td><td>
Expand Down
25 changes: 2 additions & 23 deletions docs/js-client-sdk.iprecomputedclientconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,19 @@ Description
</th></tr></thead>
<tbody><tr><td>

[subjectAttributes?](./js-client-sdk.iprecomputedclientconfig.subjectattributes.md)
[precompute](./js-client-sdk.iprecomputedclientconfig.precompute.md)


</td><td>


</td><td>

Record&lt;string, AttributeType&gt;
IPrecompute


</td><td>

_(Optional)_ Subject attributes to use for precomputed flag assignments.


</td></tr>
<tr><td>

[subjectKey](./js-client-sdk.iprecomputedclientconfig.subjectkey.md)


</td><td>


</td><td>

string


</td><td>

Subject key to use for precomputed flag assignments.


</td></tr>
</tbody></table>
Original file line number Diff line number Diff line change
@@ -1,13 +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; [IPrecomputedClientConfig](./js-client-sdk.iprecomputedclientconfig.md) &gt; [subjectKey](./js-client-sdk.iprecomputedclientconfig.subjectkey.md)
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IPrecomputedClientConfig](./js-client-sdk.iprecomputedclientconfig.md) &gt; [precompute](./js-client-sdk.iprecomputedclientconfig.precompute.md)

## IPrecomputedClientConfig.subjectKey property

Subject key to use for precomputed flag assignments.
## IPrecomputedClientConfig.precompute property

**Signature:**

```typescript
subjectKey: string;
precompute: IPrecompute;
```
13 changes: 0 additions & 13 deletions docs/js-client-sdk.iprecomputedclientconfig.subjectattributes.md

This file was deleted.

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; [IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md) &gt; [assignmentLogger](./js-client-sdk.iprecomputedclientconfigsync.assignmentlogger.md)

## IPrecomputedClientConfigSync.assignmentLogger property

**Signature:**

```typescript
assignmentLogger?: IAssignmentLogger;
```
97 changes: 97 additions & 0 deletions docs/js-client-sdk.iprecomputedclientconfigsync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!-- 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; [IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md)

## IPrecomputedClientConfigSync interface

Configuration parameters for initializing the Eppo precomputed client.

This interface is used for cases where precomputed assignments are available from an external process that can bootstrap the SDK client.

precomputedConfiguration - The configuration as a string to bootstrap the client. assignmentLogger - Optional logger for assignment events. throwOnFailedInitialization - Optional flag to throw an error if initialization fails.

**Signature:**

```typescript
export interface IPrecomputedClientConfigSync
```

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[assignmentLogger?](./js-client-sdk.iprecomputedclientconfigsync.assignmentlogger.md)


</td><td>


</td><td>

IAssignmentLogger


</td><td>

_(Optional)_


</td></tr>
<tr><td>

[precomputedConfiguration](./js-client-sdk.iprecomputedclientconfigsync.precomputedconfiguration.md)


</td><td>


</td><td>

string


</td><td>


</td></tr>
<tr><td>

[throwOnFailedInitialization?](./js-client-sdk.iprecomputedclientconfigsync.throwonfailedinitialization.md)


</td><td>


</td><td>

boolean


</td><td>

_(Optional)_


</td></tr>
</tbody></table>
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; [IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md) &gt; [precomputedConfiguration](./js-client-sdk.iprecomputedclientconfigsync.precomputedconfiguration.md)

## IPrecomputedClientConfigSync.precomputedConfiguration property

**Signature:**

```typescript
precomputedConfiguration: string;
```
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; [IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md) &gt; [throwOnFailedInitialization](./js-client-sdk.iprecomputedclientconfigsync.throwonfailedinitialization.md)

## IPrecomputedClientConfigSync.throwOnFailedInitialization property

**Signature:**

```typescript
throwOnFailedInitialization?: boolean;
```
30 changes: 30 additions & 0 deletions docs/js-client-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ The purpose is for use-cases where the configuration is available from an extern
This method should be called once on application startup.


</td></tr>
<tr><td>

[offlinePrecomputedInit(config)](./js-client-sdk.offlineprecomputedinit.md)


</td><td>

Initializes the Eppo precomputed client with configuration parameters.

The purpose is for use-cases where the precomputed assignments are available from an external process that can bootstrap the SDK.

This method should be called once on application startup.


</td></tr>
<tr><td>

Expand Down Expand Up @@ -197,5 +212,20 @@ Configuration interface for synchronous client initialization.
Configuration for Eppo precomputed client initialization


</td></tr>
<tr><td>

[IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md)


</td><td>

Configuration parameters for initializing the Eppo precomputed client.

This interface is used for cases where precomputed assignments are available from an external process that can bootstrap the SDK client.

precomputedConfiguration - The configuration as a string to bootstrap the client. assignmentLogger - Optional logger for assignment events. throwOnFailedInitialization - Optional flag to throw an error if initialization fails.


</td></tr>
</tbody></table>
59 changes: 59 additions & 0 deletions docs/js-client-sdk.offlineprecomputedinit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!-- 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; [offlinePrecomputedInit](./js-client-sdk.offlineprecomputedinit.md)

## offlinePrecomputedInit() function

Initializes the Eppo precomputed client with configuration parameters.

The purpose is for use-cases where the precomputed assignments are available from an external process that can bootstrap the SDK.

This method should be called once on application startup.

**Signature:**

```typescript
export declare function offlinePrecomputedInit(config: IPrecomputedClientConfigSync): EppoPrecomputedClient;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

config


</td><td>

[IPrecomputedClientConfigSync](./js-client-sdk.iprecomputedclientconfigsync.md)


</td><td>

precomputed client configuration


</td></tr>
</tbody></table>
**Returns:**

EppoPrecomputedClient

a singleton precomputed client instance

20 changes: 18 additions & 2 deletions js-client-sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface IClientConfig extends IBaseRequestConfig {
maxRetryDelayMs?: number;
maxRetries?: number;
batchSize?: number;
maxQueueSize?: number;
};
forceReinitialize?: boolean;
maxCacheAgeSeconds?: number;
Expand Down Expand Up @@ -149,15 +150,30 @@ export function init(config: IClientConfig): Promise<EppoClient>;

// @public
export interface IPrecomputedClientConfig extends IBaseRequestConfig {
subjectAttributes?: Record<string, AttributeType>;
subjectKey: string;
// Warning: (ae-forgotten-export) The symbol "IPrecompute" needs to be exported by the entry point index.d.ts
//
// (undocumented)
precompute: IPrecompute;
}

// @public
export interface IPrecomputedClientConfigSync {
// (undocumented)
assignmentLogger?: IAssignmentLogger;
// (undocumented)
precomputedConfiguration: string;
// (undocumented)
throwOnFailedInitialization?: boolean;
}

export { ObfuscatedFlag }

// @public
export function offlineInit(config: IClientConfigSync): EppoClient;

// @public
export function offlinePrecomputedInit(config: IPrecomputedClientConfigSync): EppoPrecomputedClient;

// @public
export function precomputedInit(config: IPrecomputedClientConfig): Promise<EppoPrecomputedClient>;

Expand Down
Loading
Loading