Skip to content

Commit

Permalink
Prepare v7.0.0 release (#63)
Browse files Browse the repository at this point in the history
* Update JSDoc documentation

* Add CHANGELOG.md

* Bump version

* Update README.md
  • Loading branch information
adams85 committed Jun 13, 2023
1 parent dd5ab97 commit 483dc33
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please check the [Github Releases](https://github.com/configcat/js-ssr-sdk/releases) page for the changelog of the ConfigCat SDK for JavaScript Server Side Rendered applications.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import * as configcat from "configcat-js-ssr";
```js
const configCatClient = configcat.getClient("#YOUR-SDK-KEY#");
```
> We strongly recommend using the *ConfigCat Client* as a Singleton object in your application.

> You can acquire singleton client instances for your SDK keys using the `getClient("<sdkKey>")` factory function.
(However, please keep in mind that subsequent calls to `getClient()` with the *same SDK Key* return a *shared* client instance, which was set up by the first call.)

### 4. Get your setting value:
The async/await way:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "configcat-js-ssr",
"version": "6.0.1",
"version": "7.0.0",
"description": "ConfigCat Feature Flags for Server Side Rendered apps like NuxtJS. Official ConfigCat SDK for Server Side Rendered to easily access feature flags.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
27 changes: 21 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { HttpConfigFetcher } from "./ConfigFetcher";
import CONFIGCAT_SDK_VERSION from "./Version";

/**
* Returns an instance of ConfigCatClient for the specified SDK Key.
* Returns an instance of `ConfigCatClient` for the specified SDK Key.
* @remarks This method returns a single, shared instance per each distinct SDK Key.
* That is, a new client object is created only when there is none available for the specified SDK Key.
* Otherwise, the already created instance is returned (in which case the 'pollingMode' and 'options' arguments are ignored).
* Otherwise, the already created instance is returned (in which case the `pollingMode` and `options` arguments are ignored).
* So, please keep in mind that when you make multiple calls to this method using the same SDK Key, you may end up with multiple references to the same client object.
* @param sdkKey SDK Key to access configuration
* @param pollingMode The polling mode to use
* @param options Options for the specified polling mode
* @param sdkKey SDK Key to access the ConfigCat config.
* @param pollingMode The polling mode to use.
* @param options Options for the specified polling mode.
*/
export function getClient<TMode extends PollingMode | undefined>(sdkKey: string, pollingMode?: TMode, options?: OptionsForPollingMode<TMode>): IConfigCatClient {
return configcatcommon.getClient(sdkKey, pollingMode ?? PollingMode.AutoPoll, options,
Expand All @@ -26,26 +26,41 @@ export function getClient<TMode extends PollingMode | undefined>(sdkKey: string,
}

/**
* Disposes all existing ConfigCatClient instances.
* Disposes all existing `ConfigCatClient` instances.
*/
export function disposeAllClients(): void {
configcatcommon.disposeAllClients();
}

/**
* Creates an instance of `ConfigCatConsoleLogger`.
* @param logLevel Log level (the minimum level to use for filtering log events).
*/
export function createConsoleLogger(logLevel: LogLevel): IConfigCatLogger {
return configcatcommon.createConsoleLogger(logLevel);
}

/**
* Creates an instance of `FlagOverrides` that uses a map data source.
* @param map The map that contains the overrides.
* @param behaviour The override behaviour.
* Specifies whether the local values should override the remote values
* or local values should only be used when a remote value doesn't exist
* or the local values should be used only.
*/
export function createFlagOverridesFromMap(map: { [name: string]: NonNullable<SettingValue> }, behaviour: OverrideBehaviour): FlagOverrides {
return new FlagOverrides(new MapOverrideDataSource(map), behaviour);
}

/** Options used to configure the ConfigCat SDK in the case of Auto Polling mode. */
export interface IJSAutoPollOptions extends IAutoPollOptions {
}

/** Options used to configure the ConfigCat SDK in the case of Lazy Loading mode. */
export interface IJSLazyLoadingOptions extends ILazyLoadingOptions {
}

/** Options used to configure the ConfigCat SDK in the case of Manual Polling mode. */
export interface IJSManualPollOptions extends IManualPollOptions {
}

Expand Down

0 comments on commit 483dc33

Please sign in to comment.