Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit f975de3

Browse files
committed
Releasing version 4.0.3
1 parent 82ba5fe commit f975de3

File tree

5 files changed

+62
-172
lines changed

5 files changed

+62
-172
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the LaunchDarkly React Native SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
44

5+
## [4.0.3] - 2021-04-28
6+
### Fixed:
7+
- The `LDEvaluationReasonErrorKind`, `LDEvaluationReasonKind`, `LDConnectionMode`, and `LDFailureReason` enum TypeScript types were undefined when evaluated at runtime due to being defined in an ambient context.
8+
59
## [4.0.2] - 2021-04-23
610
### Fixed:
711
- Android: Fixed an issue where the `jsonVariationDetail` method in `LDClient` returned `Promise<Record<string, any>>` instead of the declared return type of `Promise<LDEvaluationDetail<Record<string, any>>>`.

index.d.ts

Lines changed: 53 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -237,212 +237,67 @@ declare module 'launchdarkly-react-native-client-sdk' {
237237

238238
/**
239239
* Describes the kind of error which occurred when a flag evaluation was calculated.
240+
*
241+
* This extends String for backwards compatibility. In a future major release, references to this type
242+
* may be replaced with String references.
240243
*/
241-
export enum LDEvaluationReasonErrorKind {
242-
/**
243-
* The client is not able to establish a connection to LaunchDarkly yet.
244-
*
245-
* If there is a persistent feature store, the store does not yet contain flag data.
246-
*/
247-
CLIENT_NOT_READY = 'CLIENT_NOT_READY',
248-
249-
/**
250-
* The flag key did not match any known flag.
251-
*/
252-
FLAG_NOT_FOUND = 'FLAG_NOT_FOUND',
253-
254-
/**
255-
* The user object or user key was not provided.
256-
*/
257-
USER_NOT_SPECIFIED = 'USER_NOT_SPECIFIED',
258-
259-
/**
260-
* There was an internal inconsistency in the flag data. For example, a rule specified a nonexistent variation.
261-
*
262-
* This is an unusual condition that might require assistance from LaunchDarkly's Support team.
263-
*/
264-
MALFORMED_FLAG = 'MALFORMED_FLAG',
265-
266-
/**
267-
* The application code requested the flag value with a different data type than it actually is.
268-
*
269-
* For example, the code asked for a boolean when the flag type is actually a string.
270-
*/
271-
WRONG_TYPE = 'WRONG_TYPE',
272-
273-
/**
274-
* An unexpected error stopped flag evaluation. This could happen if you are using a persistent feature store and the database stops working.
275-
*
276-
* When this happens, the SDK always prints the specific error to the log.
277-
*/
278-
EXCEPTION = 'EXCEPTION',
244+
export interface LDEvaluationReasonErrorKind extends String {
279245
}
280246

281247
/**
282248
* Describes the reason behind how a flag evaluation was calculated.
249+
*
250+
* This extends String for backwards compatibility. In a future major release, references to this type
251+
* may be replaced with String references.
283252
*/
284-
export enum LDEvaluationReasonKind {
285-
/**
286-
* The flag is off and therefore returned its configured off value.
287-
*
288-
* This value appears on the dashboard next to "If targeting is off, serve:".
289-
*/
290-
OFF = 'OFF',
291-
292-
/**
293-
* The flag is on, but the user did not match any targets or rules, so it returned the value that appears on the dashboard under "Default rule."
294-
*/
295-
FALLTHROUGH = 'FALLTHROUGH',
296-
297-
/**
298-
* The user key was specifically targeted for this flag in the "Target individual users" section.
299-
*/
300-
TARGET_MATCH = 'TARGET_MATCH',
301-
302-
/**
303-
* The user who encountered the flag matched one of the flag's rules.
304-
*/
305-
RULE_MATCH = 'RULE_MATCH',
306-
307-
/**
308-
* The flag had at least one prerequisite flag that either was off or did not return the desired variation.
309-
*
310-
* Because of this, the flag returned its "off" value.
311-
*/
312-
PREREQUISITE_FAILED = 'PREREQUISITE_FAILED',
313-
314-
/**
315-
* The flag could not be evaluated, so the default value was returned.
316-
*/
317-
ERROR = 'ERROR',
253+
export interface LDEvaluationReasonKind extends String {
318254
}
319255

320256
/**
321257
* Describes what state of connection to LaunchDarkly the SDK is in.
258+
*
259+
* This extends String for backwards compatibility. In a future major release, references to this type
260+
* may be replaced with String references.
322261
*/
323-
export enum LDConnectionMode {
324-
/**
325-
* The SDK is either connected to the flag stream, or is actively attempting to acquire a connection.
326-
*/
327-
STREAMING = 'STREAMING',
328-
329-
/**
330-
* The SDK was configured with streaming disabled, and is in foreground polling mode.
331-
*/
332-
POLLING = 'POLLING',
333-
334-
/**
335-
* (Android specific enum value) The SDK has detected the application is in the background and has transitioned to
336-
* battery conscious background polling.
337-
*/
338-
BACKGROUND_POLLING = 'BACKGROUND_POLLING',
339-
340-
/**
341-
* (Android specific enum value) The SDK was configured with background polling disabled. The SDK has detected
342-
* the application is in the background and is not attempting to update the flag cache.
343-
*/
344-
BACKGROUND_DISABLED = 'BACKGROUND_DISABLED',
345-
346-
/**
347-
* The SDK has detected that the mobile device does not have an active network connection so has ceased flag update
348-
* attempts until the network status changes.
349-
*/
350-
OFFLINE = 'OFFLINE',
351-
352-
/**
353-
* (Android specific enum value) The SDK has been explicitly set offline, either in the initial configuration,
354-
* by setOffline(), or as a result of failed authentication to LaunchDarkly.
355-
* The SDK will stay offline unless setOnline() is called.
356-
*/
357-
SET_OFFLINE = 'SET_OFFLINE',
358-
359-
/**
360-
* (Android specific enum value) The shutdown state indicates the SDK has been permanently shutdown as a result of
361-
* a call to close().
362-
*/
363-
SHUTDOWN = 'SHUTDOWN',
364-
365-
/**
366-
* (iOS specific enum value) The SDK is attempting to connect to LaunchDarkly by streaming.
367-
*/
368-
ESTABLISHING_STREAMING_CONNECTION = 'ESTABLISHING_STREAMING_CONNECTION',
262+
export interface LDConnectionMode extends String {
369263
}
370264

371265
/**
372266
* Describes why a connection request to LaunchDarkly failed.
267+
*
268+
* This extends String for backwards compatibility. In a future major release, references to this type
269+
* may be replaced with String references.
373270
*/
374-
export enum LDFailureReason {
375-
/**
376-
* This indicates when no error has been recorded.
377-
*/
378-
NONE = 'NONE',
379-
380-
/**
381-
* This indicates when there is an internal error in the stream request.
382-
*/
383-
UKNOWN_ERROR ='UNKNOWN_ERROR',
384-
385-
/**
386-
* (iOS specific enum value) This indicates when an incorrect mobile key is provided.
387-
*/
388-
UNAUTHORIZED = 'UNAUTHORIZED',
389-
390-
/**
391-
* (iOS specific enum value) This indicates when an error with an HTTP error code is present.
392-
*/
393-
HTTP_ERROR = 'HTTP_ERROR',
394-
395-
/**
396-
* (Android specific enum value) This indicates the LDFailure is an instance of LDInvalidResponseCodeFailure.
397-
* See Android documentation for more details.
398-
*/
399-
UNEXPECTED_RESPONSE_CODE = 'UNEXPECTED_RESPONSE_CODE',
400-
401-
/**
402-
* (Android specific enum value) An event was received through the stream was had an unknown event name.
403-
* This could indicate a newer SDK is available if new event types have become available through the
404-
* flag stream since the SDKs release.
405-
*/
406-
UNEXPECTED_STREAM_ELEMENT_TYPE = 'UNEXPECTED_STREAM_ELEMENT_TYPE',
407-
408-
/**
409-
* (Android specific enum value) A network request for polling, or the EventSource stream reported a failure.
410-
*/
411-
NETWORK_FAILURE = 'NETWORK_FAILURE',
412-
413-
/**
414-
* (Android specific enum value) A response body received either through polling or streaming was unable to be parsed.
415-
*/
416-
INVALID_RESPONSE_BODY = 'INVALID_RESPONSE_BODY',
271+
export interface LDFailureReason extends String {
417272
}
418273

419274
/**
420275
* The flag is off and therefore returned its configured off value.
421276
*/
422277
export type LDEvaluationReasonOff = {
423-
kind: LDEvaluationReasonKind.OFF;
278+
kind: 'OFF';
424279
};
425280

426281
/**
427282
* The flag is on, but the user did not match any targets or rules, so it returned the value that appears
428283
* on the dashboard under "Default rule."
429284
*/
430285
export type LDEvaluationReasonFallthrough = {
431-
kind: LDEvaluationReasonKind.FALLTHROUGH;
286+
kind: 'FALLTHROUGH';
432287
};
433288

434289
/**
435290
* The user key was specifically targeted for this flag in the "Target individual users" section.
436291
*/
437292
export type LDEvaluationReasonTargetMatch = {
438-
kind: LDEvaluationReasonKind.TARGET_MATCH;
293+
kind: 'TARGET_MATCH';
439294
};
440295

441296
/**
442297
* The user who encountered the flag matched one of the flag's rules.
443298
*/
444299
export type LDEvaluationReasonRuleMatch = {
445-
kind: LDEvaluationReasonKind.RULE_MATCH;
300+
kind: 'RULE_MATCH';
446301

447302
/**
448303
* The positional index of the matched rule (0 for the first rule).
@@ -460,7 +315,7 @@ declare module 'launchdarkly-react-native-client-sdk' {
460315
* Because of this, the flag returned its "off" value.
461316
*/
462317
export type LDEvaluationReasonPrerequisiteFailed = {
463-
kind: LDEvaluationReasonKind.PREREQUISITE_FAILED;
318+
kind: 'PREREQUISITE_FAILED';
464319

465320
/**
466321
* The key of the prerequisite flag that failed.
@@ -472,10 +327,19 @@ declare module 'launchdarkly-react-native-client-sdk' {
472327
* The flag could not be evaluated, so the default value was returned.
473328
*/
474329
export type LDEvaluationReasonError = {
475-
kind: LDEvaluationReasonKind.ERROR;
330+
kind: 'ERROR';
476331

477332
/**
478333
* The kind of error which occurred.
334+
*
335+
* Kinds of errors include:
336+
*
337+
* - `'CLIENT_NOT_READY'`: The client is not able to establish a connection to LaunchDarkly yet. If there is a persistent feature store, the store does not yet contain flag data.
338+
* - `'FLAG_NOT_FOUND'`: The flag key did not match any known flag.
339+
* - `'USER_NOT_SPECIFIED'`: The user object or user key was not provided.
340+
* - `'MALFORMED_FLAG'`: There was an internal inconsistency in the flag data. For example, a rule specified a nonexistent variation. This is an unusual condition that might require assistance from LaunchDarkly's Support team.
341+
* - `'WRONG_TYPE'`: The application code requested the flag value with a different data type than it actually is. For example, the code asked for a boolean when the flag type is actually a string.
342+
* - `'EXCEPTION'`: An unexpected error stopped flag evaluation. This could happen if you are using a persistent feature store and the database stops working. When this happens, the SDK always prints the specific error to the log.
479343
*/
480344
errorKind: LDEvaluationReasonErrorKind;
481345
};
@@ -854,7 +718,18 @@ declare module 'launchdarkly-react-native-client-sdk' {
854718

855719
/**
856720
* Returns the current state of the connection to LaunchDarkly.
721+
*
722+
* States include:
857723
*
724+
* - `'STREAMING'`: The SDK is either connected to the flag stream, or is actively attempting to acquire a connection.
725+
* - `'POLLING'`: The SDK was configured with streaming disabled, and is in foreground polling mode.
726+
* - `'BACKGROUND_POLLING'`: (Android specific enum value) The SDK has detected the application is in the background and has transitioned to battery conscious background polling.
727+
* - `'BACKGROUND_DISABLED'`: (Android specific enum value) The SDK was configured with background polling disabled. The SDK has detected the application is in the background and is not attempting to update the flag cache.
728+
* - `'OFFLINE'`: The SDK has detected that the mobile device does not have an active network connection so has ceased flag update attempts until the network status changes.
729+
* - `'SET_OFFLINE'`: (Android specific enum value) The SDK has been explicitly set offline, either in the initial configuration, by setOffline(), or as a result of failed authentication to LaunchDarkly. The SDK will stay offline unless setOnline() is called.
730+
* - `'SHUTDOWN'`: (Android specific enum value) The shutdown state indicates the SDK has been permanently shutdown as a result of a call to close().
731+
* - `'ESTABLISHING_STREAMING_CONNECTION'`: (iOS specific enum value) The SDK is attempting to connect to LaunchDarkly by streaming.
732+
*
858733
* @returns
859734
* A promise containing a LDConnectionMode enum value representing the status of the connection to LaunchDarkly.
860735
*/
@@ -882,7 +757,18 @@ declare module 'launchdarkly-react-native-client-sdk' {
882757

883758
/**
884759
* Returns the most recent connection failure reason or null.
760+
*
761+
* Reasons include:
885762
*
763+
* - `'NONE'`: This indicates when no error has been recorded.
764+
* - `'UNKNOWN_ERROR'`: This indicates when there is an internal error in the stream request.
765+
* - `'UNAUTHORIZED'`: (iOS specific enum value) This indicates when an incorrect mobile key is provided.
766+
* - `'HTTP_ERROR'`: (iOS specific enum value) This indicates when an error with an HTTP error code is present.
767+
* - `'UNEXPECTED_RESPONSE_CODE'`: (Android specific enum value) This indicates the LDFailure is an instance of LDInvalidResponseCodeFailure. See Android documentation for more details.
768+
* - `'UNEXPECTED_STREAM_ELEMENT_TYPE'`: (Android specific enum value) An event was received through the stream was had an unknown event name. This could indicate a newer SDK is available if new event types have become available through the flag stream since the SDKs release.
769+
* - `'NETWORK_FAILURE'`: (Android specific enum value) A network request for polling, or the EventSource stream reported a failure.
770+
* - `'INVALID_RESPONSE_BODY'`: (Android specific enum value) A response body received either through polling or streaming was unable to be parsed.
771+
*
886772
* @returns
887773
* A promise containing a LDFailureReason enum value representing the reason for the most recently failed
888774
* connection to LaunchDarkly, or null if a failed connection has yet to occur.

ios/LaunchdarklyReactNativeClient.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Pod::Spec.new do |s|
33
s.name = "LaunchdarklyReactNativeClient"
4-
s.version = "4.0.2"
4+
s.version = "4.0.3"
55
s.summary = "LaunchdarklyReactNativeClient"
66
s.description = <<-DESC
77
LaunchdarklyReactNativeClient

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "launchdarkly-react-native-client-sdk",
3-
"version": "4.0.2",
3+
"version": "4.0.3",
44
"description": "",
55
"main": "index.js",
66
"types": "index.d.ts",
@@ -22,8 +22,8 @@
2222
},
2323
"homepage": "https://docs.launchdarkly.com/sdk/client-side/react-native",
2424
"peerDependencies": {
25-
"react-native": "~0.63",
26-
"react": "~16.13.0"
25+
"react": "~16.13.0",
26+
"react-native": "~0.63"
2727
},
2828
"devDependencies": {
2929
"metro-react-native-babel-preset": "0.59.0",

0 commit comments

Comments
 (0)