Skip to content
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
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|^.secrets.baseline$",
"lines": null
},
"generated_at": "2025-04-29T10:55:37Z",
"generated_at": "2025-07-17T19:49:02Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
30 changes: 16 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ibm-appconfiguration-js-client-sdk",
"version": "0.2.0-beta.2",
"version": "0.2.0-beta.3",
"description": "IBM Cloud App Configuration JavaScript Client SDK",
"keywords": [
"client-sdk",
Expand Down
9 changes: 1 addition & 8 deletions src/models/Experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

export interface IExperiment {
experiment_id: string;
experiment_name?: string;
hypothesis?: string;
experiment_status?: string;
traffic_distribution_json: TrafficDistribution;
traffic_distribution: TrafficDistribution;
iteration: Iteration;
variations: Variation[];
metrics: Metric[];
Expand All @@ -40,22 +38,17 @@ export interface Group {

export interface Iteration {
iteration_id: string;
iteration_name?: string;
iteration_key: string;
start_time?: Date;
}

export interface Variation {
description?: string;
variation_id: string;
variation_name?: string;
variation_value: string;
}

export interface Metric {
metric_id: string;
primary: boolean;
metric_name?: string;
metric_type: string;
event_type: string;
event_key: string;
Expand Down
6 changes: 3 additions & 3 deletions src/models/Feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default class Feature {
if (this.enabled) {
if (this.experiment && this.experiment.experiment_status === 'RUNNING') {
// experiment is running
const trafficDistribution = this.experiment.traffic_distribution_json;
const trafficDistribution = this.experiment.traffic_distribution;
const { iteration } = this.experiment;
const { variations } = this.experiment;
if (trafficDistribution.type === 'ALL') {
Expand Down Expand Up @@ -223,7 +223,7 @@ export default class Feature {
logger.error('no variation was found to serve');
return { current_value: evaluationResult.value }
}
if (trafficDistribution.type === 'DEFAULT_RULE') {
if (trafficDistribution.type === 'NO_RULE') {
evaluationResult.evaluated_segment_id = Constants.DEFAULT_SEGMENT_ID;
if (this.segment_rules.length > 0 && Object.keys(entityAttributes).length > 0) {
const rulesMap = this.parseRules(this.segment_rules);
Expand Down Expand Up @@ -309,7 +309,7 @@ export default class Feature {
// check whether the entityAttributes satifies all the rules of that segment
if (this.evaluateSegment(segmentId, entityAttributes)) {
evaluationResult.evaluated_segment_id = segmentId;
const expRuleId = parseInt(trafficDistribution.rule_id.split('-')[1])
const expRuleId = parseInt(trafficDistribution.rule_id)
if (expRuleId === segmentRule.order) {
const allVariations: VariationWithAudience[] = [];
for (const expV of trafficDistribution.experimental_group) {
Expand Down