@rolloutctrl/js-sdk 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -17
- package/dist/index.mjs +16 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -441,26 +441,25 @@ var RolloutCtrlClient = class {
|
|
|
441
441
|
const config = this.repository.getConfiguration();
|
|
442
442
|
const flag = config.flags.find((f) => f.key === flagKey);
|
|
443
443
|
if (!flag) return;
|
|
444
|
-
|
|
445
|
-
if (result.variant) {
|
|
446
|
-
type = "VARIANT_EXPOSURE";
|
|
447
|
-
} else if (result.strategy) {
|
|
448
|
-
type = "STRATEGY_MATCH";
|
|
449
|
-
} else if (result.enabled) {
|
|
450
|
-
type = "FLAG_ENABLED";
|
|
451
|
-
} else {
|
|
452
|
-
type = "FLAG_DISABLED";
|
|
453
|
-
}
|
|
454
|
-
const fingerprint = `${type}:${result.strategy?.id ?? ""}:${result.variant?.id ?? ""}`;
|
|
444
|
+
const fingerprint = `${result.enabled ? 1 : 0}:${result.strategy?.id ?? ""}:${result.variant?.id ?? ""}`;
|
|
455
445
|
if (this.trackedEvaluations.get(flagKey) === fingerprint) return;
|
|
456
446
|
this.trackedEvaluations.set(flagKey, fingerprint);
|
|
457
|
-
|
|
447
|
+
const base = {
|
|
458
448
|
featureFlagId: flag.id,
|
|
459
|
-
featureFlagEnvironmentId: flag.featureFlagEnvironmentId
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
449
|
+
featureFlagEnvironmentId: flag.featureFlagEnvironmentId
|
|
450
|
+
};
|
|
451
|
+
this.metricsQueue.push({ ...base, type: "FLAG_EVALUATION" });
|
|
452
|
+
if (result.enabled) {
|
|
453
|
+
this.metricsQueue.push({ ...base, type: "FLAG_ENABLED" });
|
|
454
|
+
if (result.strategy?.id) {
|
|
455
|
+
this.metricsQueue.push({ ...base, type: "STRATEGY_MATCH", strategyId: result.strategy.id });
|
|
456
|
+
}
|
|
457
|
+
if (result.variant?.id) {
|
|
458
|
+
this.metricsQueue.push({ ...base, type: "VARIANT_EXPOSURE", variantId: result.variant.id });
|
|
459
|
+
}
|
|
460
|
+
} else {
|
|
461
|
+
this.metricsQueue.push({ ...base, type: "FLAG_DISABLED" });
|
|
462
|
+
}
|
|
464
463
|
} catch {
|
|
465
464
|
}
|
|
466
465
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -412,26 +412,25 @@ var RolloutCtrlClient = class {
|
|
|
412
412
|
const config = this.repository.getConfiguration();
|
|
413
413
|
const flag = config.flags.find((f) => f.key === flagKey);
|
|
414
414
|
if (!flag) return;
|
|
415
|
-
|
|
416
|
-
if (result.variant) {
|
|
417
|
-
type = "VARIANT_EXPOSURE";
|
|
418
|
-
} else if (result.strategy) {
|
|
419
|
-
type = "STRATEGY_MATCH";
|
|
420
|
-
} else if (result.enabled) {
|
|
421
|
-
type = "FLAG_ENABLED";
|
|
422
|
-
} else {
|
|
423
|
-
type = "FLAG_DISABLED";
|
|
424
|
-
}
|
|
425
|
-
const fingerprint = `${type}:${result.strategy?.id ?? ""}:${result.variant?.id ?? ""}`;
|
|
415
|
+
const fingerprint = `${result.enabled ? 1 : 0}:${result.strategy?.id ?? ""}:${result.variant?.id ?? ""}`;
|
|
426
416
|
if (this.trackedEvaluations.get(flagKey) === fingerprint) return;
|
|
427
417
|
this.trackedEvaluations.set(flagKey, fingerprint);
|
|
428
|
-
|
|
418
|
+
const base = {
|
|
429
419
|
featureFlagId: flag.id,
|
|
430
|
-
featureFlagEnvironmentId: flag.featureFlagEnvironmentId
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
420
|
+
featureFlagEnvironmentId: flag.featureFlagEnvironmentId
|
|
421
|
+
};
|
|
422
|
+
this.metricsQueue.push({ ...base, type: "FLAG_EVALUATION" });
|
|
423
|
+
if (result.enabled) {
|
|
424
|
+
this.metricsQueue.push({ ...base, type: "FLAG_ENABLED" });
|
|
425
|
+
if (result.strategy?.id) {
|
|
426
|
+
this.metricsQueue.push({ ...base, type: "STRATEGY_MATCH", strategyId: result.strategy.id });
|
|
427
|
+
}
|
|
428
|
+
if (result.variant?.id) {
|
|
429
|
+
this.metricsQueue.push({ ...base, type: "VARIANT_EXPOSURE", variantId: result.variant.id });
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
this.metricsQueue.push({ ...base, type: "FLAG_DISABLED" });
|
|
433
|
+
}
|
|
435
434
|
} catch {
|
|
436
435
|
}
|
|
437
436
|
}
|