diff --git a/packages/shared/sdk-client/src/api/LDOptions.ts b/packages/shared/sdk-client/src/api/LDOptions.ts index 06484397c..946cce96e 100644 --- a/packages/shared/sdk-client/src/api/LDOptions.ts +++ b/packages/shared/sdk-client/src/api/LDOptions.ts @@ -4,44 +4,11 @@ import type { LDInspection } from './LDInspection'; export interface LDOptions { /** - * Whether all context attributes (except the context key) should be marked as private, and - * not sent to LaunchDarkly in analytics events. - * - * By default, this is false. - */ - allAttributesPrivate?: boolean; - - /** - * Information about the application where the LaunchDarkly SDK is running. - */ - application?: { - /** - * A unique identifier representing the application where the LaunchDarkly SDK is running. - * - * This can be specified as any string value as long as it only uses the following characters: ASCII letters, - * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored. - * - * Example: `authentication-service` - */ - id?: string; - - /** - * A unique identifier representing the version of the application where the LaunchDarkly SDK is running. - * - * This can be specified as any string value as long as it only uses the following characters: ASCII letters, - * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored. - * - * Example: `1.0.0` (standard version string) or `abcdef` (sha prefix) - */ - version?: string; - }; - - /** - * The base uri for the LaunchDarkly server. + * An object that will perform logging for the client. * - * Most users should use the default value. + * If not specified, the default is to use `basicLogger`. */ - baseUri?: string; + logger?: LDLogger; /** * The initial set of flags to use until the remote set is retrieved. @@ -57,37 +24,11 @@ export interface LDOptions { bootstrap?: 'localStorage' | LDFlagSet; /** - * The capacity of the analytics events queue. - * - * The client buffers up to this many events in memory before flushing. If the capacity is exceeded - * before the queue is flushed, events will be discarded. Increasing the capacity means that events - * are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage - * flag evaluations do not produce individual events, only summary counts, so you only need a large - * capacity if you are generating a large number of click, pageview, or identify events (or if you - * are using the event debugger). - * - * The default value is 100. - */ - capacity?: number; - - /** - * Set to true to opt out of sending diagnostics data. - * - * Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly - * servers in order to assist in the development of future SDK improvements. These diagnostics consist of - * an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the - * SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such - * as dropped events. - */ - diagnosticOptOut?: boolean; - - /** - * The interval at which periodic diagnostic data is sent, in seconds. + * The base uri for the LaunchDarkly server. * - * The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut} - * for more information on the diagnostics data being sent. + * Most users should use the default value. */ - diagnosticRecordingInterval?: number; + baseUri?: string; /** * The base uri for the LaunchDarkly events server. @@ -97,31 +38,34 @@ export interface LDOptions { eventsUri?: string; /** - * The interval in between flushes of the analytics events queue, in seconds. + * The base uri for the LaunchDarkly streaming server. * - * The default value is 2s. + * Most users should use the default value. */ - flushInterval?: number; + streamUri?: string; /** - * The signed context key for Secure Mode. + * Whether LaunchDarkly should provide additional information about how flag values were + * calculated. * - * For more information, see the JavaScript SDK Reference Guide on - * [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk). + * The additional information will then be available through the client's + * {@link LDClient.variationDetail} method. Since this increases the size of network requests, + * such information is not sent unless you set this option to true. */ - hash?: string; + withReasons?: boolean; /** - * Inspectors can be used for collecting information for monitoring, analytics, and debugging. + * Whether to send analytics events back to LaunchDarkly. By default, this is true. */ - inspectors?: LDInspection[]; + sendEvents?: boolean; /** - * An object that will perform logging for the client. + * Whether all context attributes (except the context key) should be marked as private, and + * not sent to LaunchDarkly in analytics events. * - * If not specified, the default is to use `basicLogger`. + * By default, this is false. */ - logger?: LDLogger; + allAttributesPrivate?: boolean; /** * Specifies a list of attribute names (either built-in or custom) which should be marked as @@ -143,9 +87,25 @@ export interface LDOptions { privateAttributes?: Array; /** - * Whether to send analytics events back to LaunchDarkly. By default, this is true. + * The capacity of the analytics events queue. + * + * The client buffers up to this many events in memory before flushing. If the capacity is exceeded + * before the queue is flushed, events will be discarded. Increasing the capacity means that events + * are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage + * flag evaluations do not produce individual events, only summary counts, so you only need a large + * capacity if you are generating a large number of click, pageview, or identify events (or if you + * are using the event debugger). + * + * The default value is 100. */ - sendEvents?: boolean; + capacity?: number; + + /** + * The interval in between flushes of the analytics events queue, in seconds. + * + * The default value is 2s. + */ + flushInterval?: number; /** * Sets the initial reconnect delay for the streaming connection, in seconds. @@ -159,21 +119,23 @@ export interface LDOptions { streamInitialReconnectDelay?: number; /** - * The base uri for the LaunchDarkly streaming server. + * Set to true to opt out of sending diagnostics data. * - * Most users should use the default value. + * Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly + * servers in order to assist in the development of future SDK improvements. These diagnostics consist of + * an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the + * SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such + * as dropped events. */ - streamUri?: string; + diagnosticOptOut?: boolean; /** - * Whether LaunchDarkly should provide additional information about how flag values were - * calculated. + * The interval at which periodic diagnostic data is sent, in seconds. * - * The additional information will then be available through the client's - * {@link LDClient.variationDetail} method. Since this increases the size of network requests, - * such information is not sent unless you set this option to true. + * The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut} + * for more information on the diagnostics data being sent. */ - withReasons?: boolean; + diagnosticRecordingInterval?: number; /** * For use by wrapper libraries to set an identifying name for the wrapper being used. @@ -189,4 +151,42 @@ export interface LDOptions { * If `wrapperName` is unset, this field will be ignored. */ wrapperVersion?: string; + + /** + * Information about the application where the LaunchDarkly SDK is running. + */ + application?: { + /** + * A unique identifier representing the application where the LaunchDarkly SDK is running. + * + * This can be specified as any string value as long as it only uses the following characters: ASCII letters, + * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored. + * + * Example: `authentication-service` + */ + id?: string; + + /** + * A unique identifier representing the version of the application where the LaunchDarkly SDK is running. + * + * This can be specified as any string value as long as it only uses the following characters: ASCII letters, + * ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored. + * + * Example: `1.0.0` (standard version string) or `abcdef` (sha prefix) + */ + version?: string; + }; + + /** + * Inspectors can be used for collecting information for monitoring, analytics, and debugging. + */ + inspectors?: LDInspection[]; + + /** + * The signed context key for Secure Mode. + * + * For more information, see the JavaScript SDK Reference Guide on + * [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk). + */ + hash?: string; }