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

chore: move initialization into class methods, limit singleton use #170

Merged
merged 12 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions docs/js-client-sdk.eppojsclient.initialized.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## EppoJSClient.initialized property

> Warning: This API is now obsolete.
>
>

**Signature:**

```typescript
Expand Down
2 changes: 2 additions & 0 deletions docs/js-client-sdk.eppojsclient.instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## EppoJSClient.instance property

@<!-- -->deprecated. use `getInstance()` instead.

**Signature:**

```typescript
Expand Down
2 changes: 2 additions & 0 deletions docs/js-client-sdk.eppojsclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ boolean

</td><td>

@<!-- -->deprecated. use `getInstance()` instead.


</td></tr>
</tbody></table>
Expand Down
4 changes: 2 additions & 2 deletions docs/js-client-sdk.getinstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Used to access a singleton SDK client instance. Use the method after calling ini
**Signature:**

```typescript
export declare function getInstance(): EppoClient;
export declare function getInstance(): EppoJSClient;
```
**Returns:**

EppoClient
[EppoJSClient](./js-client-sdk.eppojsclient.md)

a singleton client instance

4 changes: 2 additions & 2 deletions docs/js-client-sdk.init.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Initializes the Eppo client with configuration parameters. This method should be
**Signature:**

```typescript
export declare function init(config: IClientConfig): Promise<EppoClient>;
export declare function init(config: IClientConfig): Promise<EppoJSClient>;
```

## Parameters
Expand Down Expand Up @@ -49,5 +49,5 @@ client configuration
</tbody></table>
**Returns:**

Promise&lt;EppoClient&gt;
Promise&lt;[EppoJSClient](./js-client-sdk.eppojsclient.md)<!-- -->&gt;

11 changes: 7 additions & 4 deletions js-client-sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ export class EppoJSClient extends EppoClient {
getStringAssignment(flagKey: string, subjectKey: string, subjectAttributes: Record<string, AttributeType>, defaultValue: string): string;
// (undocumented)
getStringAssignmentDetails(flagKey: string, subjectKey: string, subjectAttributes: Record<string, AttributeType>, defaultValue: string): IAssignmentDetails<string>;
// (undocumented)
// @internal (undocumented)
init(config: Omit<IClientConfig, 'forceReinitialize'>): Promise<EppoJSClient>;
// @deprecated (undocumented)
static initialized: boolean;
// (undocumented)
static instance: EppoJSClient;
// @internal (undocumented)
offlineInit(config: IClientConfigSync): void;
}

// @public
Expand Down Expand Up @@ -116,7 +119,7 @@ export { Flag }
export function getConfigUrl(apiKey: string, baseUrl?: string): URL;

// @public
export function getInstance(): EppoClient;
export function getInstance(): EppoJSClient;

// @public
export function getPrecomputedInstance(): EppoPrecomputedClient;
Expand Down Expand Up @@ -169,7 +172,7 @@ export interface IClientConfigSync {
}

// @public
export function init(config: IClientConfig): Promise<EppoClient>;
export function init(config: IClientConfig): Promise<EppoJSClient>;

// @public
export interface IPrecomputedClientConfig extends IBaseRequestConfig {
Expand Down
Loading
Loading