Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 1.85 KB

v0.3-v0.4.md

File metadata and controls

34 lines (29 loc) · 1.85 KB

v0.3 to v0.4 Migration Guide

Version v0.4 of App Configuration Node SDK introduces a enhancement to return detailed information of the evaluation value as part of the getCurrentValue method. Read this guide to understand the differences and what changes you should make in your application.

Breaking changes

Versions 0.3.1 and below

Call to getCurrentValue will return the evaluated value of the feature flag. The type of the return value will match that of feature flag (Numeric/Boolean/String).

const feature = appConfigClient.getFeature('discount');
if (feature !== null) {
    const result = feature.getCurrentValue(entityId, entityAttributes);
    console.log(result) // Example output: 25
}

Versions 0.4.0 and above

Call to getCurrentValue will return an JSON object containing evaluated value, feature flag enabled status & evaluation details. The return type will always be an valid JSON object. The evaluated value, enabled status and evaluation details should be accessed using the (.) dot notation or ([]) bracket notation. See below

const feature = appConfigClient.getFeature('discount');
if (feature !== null) {
    const result = feature.getCurrentValue(entityId, entityAttributes);
    console.log(result.value) // Example output: 25
    console.log(result.isEnabled) // Example output: true or false
    console.log(result.details) // Example output: A JSON object containing detailed information of the evaluation.
}

// Dot notation: result.value
// Bracket notation: result['value']

In short, if you are already using the getCurrentValue and are upgrading the SDK version from 0.3.x to 0.4.x then access the evaluated value from result.value instead of just result.

This change is applicable to properties as well.

All changes

See the release notes of each versions.