diff --git a/.secrets.baseline b/.secrets.baseline index 4deb835..ada3a52 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -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" diff --git a/package-lock.json b/package-lock.json index f38a7f9..54b9bbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ibm-appconfiguration-js-client-sdk", - "version": "0.2.0-beta.2", + "version": "0.2.0-beta.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ibm-appconfiguration-js-client-sdk", - "version": "0.2.0-beta.2", + "version": "0.2.0-beta.3", "license": "Apache-2.0", "dependencies": { "eventemitter3": "^4.0.7", @@ -2152,10 +2152,11 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6996,10 +6997,11 @@ } }, "node_modules/typedoc/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -9045,9 +9047,9 @@ "dev": true }, "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -12538,9 +12540,9 @@ }, "dependencies": { "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "requires": { "balanced-match": "^1.0.0" diff --git a/package.json b/package.json index 050b9a7..fc0e9a8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/models/Experiment.ts b/src/models/Experiment.ts index fb83a2e..29e27d6 100644 --- a/src/models/Experiment.ts +++ b/src/models/Experiment.ts @@ -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[]; @@ -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; diff --git a/src/models/Feature.ts b/src/models/Feature.ts index b63b59c..307f017 100644 --- a/src/models/Feature.ts +++ b/src/models/Feature.ts @@ -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') { @@ -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); @@ -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) {