diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1f504f4 --- /dev/null +++ b/CHANGELOG.md @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index a449c4e..21531ee 100644 --- a/README.md +++ b/README.md @@ -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("")` 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: diff --git a/package-lock.json b/package-lock.json index 4a78a10..49987b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "configcat-node", - "version": "9.1.1", + "version": "10.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "configcat-node", - "version": "9.1.1", + "version": "10.0.0", "license": "MIT", "dependencies": { "configcat-common": "^8.0.0", diff --git a/package.json b/package.json index 90aceb2..59da4e9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/client.ts b/src/client.ts index 3de19e5..548f305 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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(sdkKey: string, pollingMode?: TMode, options?: OptionsForPollingMode): IConfigCatClient { return configcatcommon.getClient(sdkKey, pollingMode ?? PollingMode.AutoPoll, options, @@ -24,30 +24,41 @@ export function getClient(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 }, 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 { } @@ -98,4 +109,4 @@ export { OverrideBehaviour } from "configcat-common"; export { RefreshResult } from "configcat-common"; -export type { IProvidesHooks, HookEvents } from "configcat-common"; \ No newline at end of file +export type { IProvidesHooks, HookEvents } from "configcat-common";