This code has been moved to https://github.com/CarnegieLearningWeb/UpGrade.git
Under the clientlibs/ directory
UpgradeClient named class is exported from this library
Two ways for initializing users
const upClient = UpgradeClient('userId', 'hostUrl');
const upClient = UpgradeClient('userId', 'hostUrl', 'token');
Set alternative user ids for current user
upClient.setAltUserIds(altUserIds)
Updates/Set the group membership of the initialized user
upClient.setGroupMembership(group)
Updates/Set the working group of the initialized user
upClient.setWorkingGroup(workingGroup)
Get all the experiment assignments for the initialized user
upClient.getAllExperimentConditions(context)
Returns the Experiment Condition for the partition and point received from the getAllExperimentConditions for the initialized user. If getAllExperimentConditions is not called before this function then it will call it internally and return the result.
upClient.getExperimentCondition(context, experimentPoint)
upClient.getExperimentCondition(context, experimentPoint, partitionId)
Calls markExperimentPoint for experiment point and partitionId. It will use the user definition from initialized user
upClient.markExperimentPoint(experimentPoint,condition)
upClient.markExperimentPoint(experimentPoint, condition, partitionId)
Use this function to report failure with given reason
upClient.failedExperimentPoint(experimentPoint, reason)
upClient.failedExperimentPoint(experimentPoint, reason, experimentId)
Use this function to log data
interface ILogMetrics {
attributes: any;
groupedMetrics: ILogGroupMetrics[];
}
interface ILogGroupMetrics {
groupClass: string;
groupKey: string;
groupUniquifier: string;
attributes: any;
}
interface ILogInput {
timestamp: string;
metrics: ILogMetrics;
}
upClient.log(value)
Use this function to add metrics in upgrade system
interface IGroupMetric {
groupClass: string;
allowedKeys: string[];
attributes: Array<IGroupMetric | ISingleMetric>;
}
interface ISingleMetric {
metric: string;
datatype: IMetricMetaData;
allowedValues?: Array<string | number>;
}
enum IMetricMetaData {
CONTINUOUS = 'continuous',
CATEGORICAL = 'categorical'
}
upClient.addMetrics(metrics)
Use this function to get feature flags list
upClient.getAllFeatureFlags()
Use this function to get feature flag matched to given key
upClient.getFeatureFlag(key)