Skip to content

Commit bb7c3b4

Browse files
authored
fix: Remove beta warning for sdk-server. Added tsdoc comments for rn sdk. Added README for sdk-client. (#334)
1 parent 4cbea8c commit bb7c3b4

File tree

4 files changed

+141
-91
lines changed

4 files changed

+141
-91
lines changed

packages/sdk/react-native/src/ReactNativeLDClient.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,26 @@ import {
99

1010
import createPlatform from './platform';
1111

12+
/**
13+
* The React Native LaunchDarkly client. Instantiate this class to create an
14+
* instance of the ReactNativeLDClient and pass it to the {@link LDProvider}.
15+
*
16+
* @example
17+
* ```tsx
18+
* const featureClient = new ReactNativeLDClient(MOBILE_KEY);
19+
*
20+
* <LDProvider client={featureClient}>
21+
* <Welcome />
22+
* </LDProvider>
23+
* ```
24+
*/
1225
export default class ReactNativeLDClient extends LDClientImpl {
26+
/**
27+
* Creates an instance of the LaunchDarkly client.
28+
*
29+
* @param sdkKey The LaunchDarkly mobile key.
30+
* @param options {@link LDOptions} to initialize the client with.
31+
*/
1332
constructor(sdkKey: string, options: LDOptions = {}) {
1433
const logger =
1534
options.logger ??
Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
# sdk-client
1+
# LaunchDarkly SDK JavaScript Common Client Code
2+
3+
[![NPM][js-client-sdk-common-npm-badge]][js-client-sdk-common-npm-link]
4+
[![Actions Status][shared-sdk-client-ci-badge]][shared-sdk-client-ci]
5+
[![Documentation][shared-sdk-client-ghp-badge]][shared-sdk-client-ghp-link]
6+
7+
This project contains Typescript classes and interfaces that are applicable to client-side SDKs.
8+
9+
This library is a beta version and should not be considered ready for production use while this message is visible.
10+
11+
## Contributing
12+
13+
See [Contributing](../CONTRIBUTING.md).
14+
15+
## About LaunchDarkly
16+
17+
- 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:
18+
- 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.
19+
- 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?).
20+
- 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.
21+
- 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.
22+
- 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.
23+
- Explore LaunchDarkly
24+
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
25+
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
26+
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
27+
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
28+
29+
[js-client-sdk-common-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/js-client-sdk-common.svg?style=flat-square
30+
[js-client-sdk-common-npm-link]: https://www.npmjs.com/package/@launchdarkly/js-client-sdk-common
31+
[shared-sdk-client-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml/badge.svg
32+
[shared-sdk-client-ci]: https://github.com/launchdarkly/js-core/actions/workflows/sdk-client.yml
33+
[shared-sdk-client-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
34+
[shared-sdk-client-ghp-link]: https://launchdarkly.github.io/js-core/packages/shared/sdk-client/docs/

packages/shared/sdk-client/src/api/LDOptions.ts

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,44 @@ import type { LDInspection } from './LDInspection';
44

55
export interface LDOptions {
66
/**
7-
* An object that will perform logging for the client.
7+
* Whether all context attributes (except the context key) should be marked as private, and
8+
* not sent to LaunchDarkly in analytics events.
89
*
9-
* If not specified, the default is to use `basicLogger`.
10+
* By default, this is false.
1011
*/
11-
logger?: LDLogger;
12+
allAttributesPrivate?: boolean;
13+
14+
/**
15+
* Information about the application where the LaunchDarkly SDK is running.
16+
*/
17+
application?: {
18+
/**
19+
* A unique identifier representing the application where the LaunchDarkly SDK is running.
20+
*
21+
* This can be specified as any string value as long as it only uses the following characters: ASCII letters,
22+
* ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
23+
*
24+
* Example: `authentication-service`
25+
*/
26+
id?: string;
27+
28+
/**
29+
* A unique identifier representing the version of the application where the LaunchDarkly SDK is running.
30+
*
31+
* This can be specified as any string value as long as it only uses the following characters: ASCII letters,
32+
* ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
33+
*
34+
* Example: `1.0.0` (standard version string) or `abcdef` (sha prefix)
35+
*/
36+
version?: string;
37+
};
38+
39+
/**
40+
* The base uri for the LaunchDarkly server.
41+
*
42+
* Most users should use the default value.
43+
*/
44+
baseUri?: string;
1245

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

2659
/**
27-
* The base uri for the LaunchDarkly server.
60+
* The capacity of the analytics events queue.
2861
*
29-
* Most users should use the default value.
62+
* The client buffers up to this many events in memory before flushing. If the capacity is exceeded
63+
* before the queue is flushed, events will be discarded. Increasing the capacity means that events
64+
* are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage
65+
* flag evaluations do not produce individual events, only summary counts, so you only need a large
66+
* capacity if you are generating a large number of click, pageview, or identify events (or if you
67+
* are using the event debugger).
68+
*
69+
* The default value is 100.
3070
*/
31-
baseUri?: string;
71+
capacity?: number;
72+
73+
/**
74+
* Set to true to opt out of sending diagnostics data.
75+
*
76+
* Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly
77+
* servers in order to assist in the development of future SDK improvements. These diagnostics consist of
78+
* an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the
79+
* SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such
80+
* as dropped events.
81+
*/
82+
diagnosticOptOut?: boolean;
83+
84+
/**
85+
* The interval at which periodic diagnostic data is sent, in seconds.
86+
*
87+
* The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut}
88+
* for more information on the diagnostics data being sent.
89+
*/
90+
diagnosticRecordingInterval?: number;
3291

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

4099
/**
41-
* The base uri for the LaunchDarkly streaming server.
100+
* The interval in between flushes of the analytics events queue, in seconds.
42101
*
43-
* Most users should use the default value.
102+
* The default value is 2s.
44103
*/
45-
streamUri?: string;
104+
flushInterval?: number;
46105

47106
/**
48-
* Whether LaunchDarkly should provide additional information about how flag values were
49-
* calculated.
107+
* The signed context key for Secure Mode.
50108
*
51-
* The additional information will then be available through the client's
52-
* {@link LDClient.variationDetail} method. Since this increases the size of network requests,
53-
* such information is not sent unless you set this option to true.
109+
* For more information, see the JavaScript SDK Reference Guide on
110+
* [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
54111
*/
55-
withReasons?: boolean;
112+
hash?: string;
56113

57114
/**
58-
* Whether to send analytics events back to LaunchDarkly. By default, this is true.
115+
* Inspectors can be used for collecting information for monitoring, analytics, and debugging.
59116
*/
60-
sendEvents?: boolean;
117+
inspectors?: LDInspection[];
61118

62119
/**
63-
* Whether all context attributes (except the context key) should be marked as private, and
64-
* not sent to LaunchDarkly in analytics events.
120+
* An object that will perform logging for the client.
65121
*
66-
* By default, this is false.
122+
* If not specified, the default is to use `basicLogger`.
67123
*/
68-
allAttributesPrivate?: boolean;
124+
logger?: LDLogger;
69125

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

89145
/**
90-
* The capacity of the analytics events queue.
91-
*
92-
* The client buffers up to this many events in memory before flushing. If the capacity is exceeded
93-
* before the queue is flushed, events will be discarded. Increasing the capacity means that events
94-
* are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage
95-
* flag evaluations do not produce individual events, only summary counts, so you only need a large
96-
* capacity if you are generating a large number of click, pageview, or identify events (or if you
97-
* are using the event debugger).
98-
*
99-
* The default value is 100.
100-
*/
101-
capacity?: number;
102-
103-
/**
104-
* The interval in between flushes of the analytics events queue, in seconds.
105-
*
106-
* The default value is 2s.
146+
* Whether to send analytics events back to LaunchDarkly. By default, this is true.
107147
*/
108-
flushInterval?: number;
148+
sendEvents?: boolean;
109149

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

121161
/**
122-
* Set to true to opt out of sending diagnostics data.
162+
* The base uri for the LaunchDarkly streaming server.
123163
*
124-
* Unless `diagnosticOptOut` is set to true, the client will send some diagnostics data to the LaunchDarkly
125-
* servers in order to assist in the development of future SDK improvements. These diagnostics consist of
126-
* an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the
127-
* SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such
128-
* as dropped events.
164+
* Most users should use the default value.
129165
*/
130-
diagnosticOptOut?: boolean;
166+
streamUri?: string;
131167

132168
/**
133-
* The interval at which periodic diagnostic data is sent, in seconds.
169+
* Whether LaunchDarkly should provide additional information about how flag values were
170+
* calculated.
134171
*
135-
* The default is 900 (every 15 minutes) and the minimum value is 6. See {@link diagnosticOptOut}
136-
* for more information on the diagnostics data being sent.
172+
* The additional information will then be available through the client's
173+
* {@link LDClient.variationDetail} method. Since this increases the size of network requests,
174+
* such information is not sent unless you set this option to true.
137175
*/
138-
diagnosticRecordingInterval?: number;
176+
withReasons?: boolean;
139177

140178
/**
141179
* For use by wrapper libraries to set an identifying name for the wrapper being used.
@@ -151,42 +189,4 @@ export interface LDOptions {
151189
* If `wrapperName` is unset, this field will be ignored.
152190
*/
153191
wrapperVersion?: string;
154-
155-
/**
156-
* Information about the application where the LaunchDarkly SDK is running.
157-
*/
158-
application?: {
159-
/**
160-
* A unique identifier representing the application where the LaunchDarkly SDK is running.
161-
*
162-
* This can be specified as any string value as long as it only uses the following characters: ASCII letters,
163-
* ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
164-
*
165-
* Example: `authentication-service`
166-
*/
167-
id?: string;
168-
169-
/**
170-
* A unique identifier representing the version of the application where the LaunchDarkly SDK is running.
171-
*
172-
* This can be specified as any string value as long as it only uses the following characters: ASCII letters,
173-
* ASCII digits, period, hyphen, underscore. A string containing any other characters will be ignored.
174-
*
175-
* Example: `1.0.0` (standard version string) or `abcdef` (sha prefix)
176-
*/
177-
version?: string;
178-
};
179-
180-
/**
181-
* Inspectors can be used for collecting information for monitoring, analytics, and debugging.
182-
*/
183-
inspectors?: LDInspection[];
184-
185-
/**
186-
* The signed context key for Secure Mode.
187-
*
188-
* For more information, see the JavaScript SDK Reference Guide on
189-
* [Secure mode](https://docs.launchdarkly.com/sdk/features/secure-mode#configuring-secure-mode-in-the-javascript-client-side-sdk).
190-
*/
191-
hash?: string;
192192
}

packages/shared/sdk-server/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

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

9-
This library is a beta version and should not be considered ready for production use while this message is visible.
10-
119
## Contributing
1210

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

0 commit comments

Comments
 (0)