Skip to content

Commit

Permalink
Prepare v10.0.0 release (#60)
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 authored Jun 13, 2023
1 parent a7e7d8c commit 198fc77
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 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/node-sdk/releases) page for the changelog of the ConfigCat SDK for Node.js.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const configcat = require("configcat-node");
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-node",
"version": "9.1.1",
"version": "10.0.0",
"description": "Official ConfigCat SDK to help you access your feature flags from a Node.js application.",
"main": "lib/client.js",
"types": "lib/client.d.ts",
Expand Down
29 changes: 20 additions & 9 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { HttpConfigFetcher } from "./config-fetcher";
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 @@ -24,30 +24,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();
}

/**
* Create an instance of ConfigCatConsoleLogger
* @param logLevel Specifies message's filtering to output for the CofigCatConsoleLogger.
* 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 INodeAutoPollOptions extends IAutoPollOptions {
}

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

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

Expand Down Expand Up @@ -98,4 +109,4 @@ export { OverrideBehaviour } from "configcat-common";

export { RefreshResult } from "configcat-common";

export type { IProvidesHooks, HookEvents } from "configcat-common";
export type { IProvidesHooks, HookEvents } from "configcat-common";

0 comments on commit 198fc77

Please sign in to comment.