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

fix: Remove beta warning for sdk-server. Added tsdoc comments for rn sdk. Added README for sdk-client. #334

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions packages/sdk/react-native/src/ReactNativeLDClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ import {

import createPlatform from './platform';

/**
* The React Native LaunchDarkly client. Instantiate this class to create an
* instance of the ReactNativeLDClient and pass it to the {@link LDProvider}.
*
* @example
* ```tsx
* const featureClient = new ReactNativeLDClient(MOBILE_KEY);
*
* <LDProvider client={featureClient}>
* <Welcome />
* </LDProvider>
* ```
*/
export default class ReactNativeLDClient extends LDClientImpl {
/**
* Creates an instance of the LaunchDarkly client.
*
* @param sdkKey The LaunchDarkly mobile key.
* @param options {@link LDOptions} to initialize the client with.
*/
constructor(sdkKey: string, options: LDOptions = {}) {
const logger =
options.logger ??
Expand Down
35 changes: 34 additions & 1 deletion packages/shared/sdk-client/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# sdk-client
# LaunchDarkly SDK JavaScript Common Client Code

[![NPM][js-client-sdk-common-npm-badge]][js-client-sdk-common-npm-link]
[![Actions Status][shared-sdk-client-ci-badge]][shared-sdk-client-ci]
[![Documentation][shared-sdk-client-ghp-badge]][shared-sdk-client-ghp-link]

This project contains Typescript classes and interfaces that are applicable to client-side SDKs.

This library is a beta version and should not be considered ready for production use while this message is visible.

## Contributing

See [Contributing](../CONTRIBUTING.md).

## About LaunchDarkly

- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
- Explore LaunchDarkly
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates

[js-client-sdk-common-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/js-client-sdk-common.svg?style=flat-square
[js-client-sdk-common-npm-link]: https://www.npmjs.com/package/@launchdarkly/js-client-sdk-common
[shared-sdk-client-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml/badge.svg
[shared-sdk-client-ci]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml
[shared-sdk-client-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
[shared-sdk-client-ghp-link]: https://launchdarkly.github.io/js-core/packages/shared/sdk-client/docs/
176 changes: 88 additions & 88 deletions packages/shared/sdk-client/src/api/LDOptions.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just sorted the options alphabetically automatically with the IDE. No functionality changes.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,44 @@ import type { LDInspection } from './LDInspection';

export interface LDOptions {
/**
* 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;

/**
* 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.
*
* Most users should use the default value.
*/
baseUri?: string;

/**
* The initial set of flags to use until the remote set is retrieved.
Expand All @@ -24,11 +57,37 @@ export interface LDOptions {
bootstrap?: 'localStorage' | LDFlagSet;

/**
* The base uri for the LaunchDarkly server.
* The capacity of the analytics events queue.
*
* Most users should use the default value.
* 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.
*/
baseUri?: string;
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 default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut}
* for more information on the diagnostics data being sent.
*/
diagnosticRecordingInterval?: number;

/**
* The base uri for the LaunchDarkly events server.
Expand All @@ -38,34 +97,31 @@ export interface LDOptions {
eventsUri?: string;

/**
* The base uri for the LaunchDarkly streaming server.
* The interval in between flushes of the analytics events queue, in seconds.
*
* Most users should use the default value.
* The default value is 2s.
*/
streamUri?: string;
flushInterval?: number;

/**
* Whether LaunchDarkly should provide additional information about how flag values were
* calculated.
* The signed context key for Secure Mode.
*
* 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.
* 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).
*/
withReasons?: boolean;
hash?: string;

/**
* Whether to send analytics events back to LaunchDarkly. By default, this is true.
* Inspectors can be used for collecting information for monitoring, analytics, and debugging.
*/
sendEvents?: boolean;
inspectors?: LDInspection[];

/**
* Whether all context attributes (except the context key) should be marked as private, and
* not sent to LaunchDarkly in analytics events.
* An object that will perform logging for the client.
*
* By default, this is false.
* If not specified, the default is to use `basicLogger`.
*/
allAttributesPrivate?: boolean;
logger?: LDLogger;

/**
* Specifies a list of attribute names (either built-in or custom) which should be marked as
Expand All @@ -87,25 +143,9 @@ export interface LDOptions {
privateAttributes?: Array<string>;

/**
* 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;

/**
* The interval in between flushes of the analytics events queue, in seconds.
*
* The default value is 2s.
* Whether to send analytics events back to LaunchDarkly. By default, this is true.
*/
flushInterval?: number;
sendEvents?: boolean;

/**
* Sets the initial reconnect delay for the streaming connection, in seconds.
Expand All @@ -119,23 +159,21 @@ export interface LDOptions {
streamInitialReconnectDelay?: number;

/**
* Set to true to opt out of sending diagnostics data.
* The base uri for the LaunchDarkly streaming server.
*
* 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.
* Most users should use the default value.
*/
diagnosticOptOut?: boolean;
streamUri?: string;

/**
* The interval at which periodic diagnostic data is sent, in seconds.
* Whether LaunchDarkly should provide additional information about how flag values were
* calculated.
*
* 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.
* 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.
*/
diagnosticRecordingInterval?: number;
withReasons?: boolean;

/**
* For use by wrapper libraries to set an identifying name for the wrapper being used.
Expand All @@ -151,42 +189,4 @@ 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;
}
2 changes: 0 additions & 2 deletions packages/shared/sdk-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

This project contains Typescript classes and interfaces that are applicable to server-side SDKs.

This library is a beta version and should not be considered ready for production use while this message is visible.
Copy link
Contributor Author

@yusinto yusinto Dec 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package been in production for a while now so this warning should be removed.


## Contributing

See [Contributing](../CONTRIBUTING.md).
Expand Down