Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hackler/sdk-core

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackler/sdk-core - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

lib/internal/evaluation/action/ActionResolver.d.ts

9

lib/internal/client/HackleInternalClient.js

@@ -8,6 +8,7 @@ "use strict";

var Evaluator_1 = require("../evaluation/Evaluator");
var EvaluationFlowFactory_1 = require("../evaluation/flow/EvaluationFlowFactory");
var log = logger_1.default.log;
var HackleInternalClient = /** @class */ (function () {
function HackleInternalClient(workspaceFetcher, eventProcessor, eventEmitter) {
this.evaluator = new Evaluator_1.default();
this.evaluator = new Evaluator_1.default(new EvaluationFlowFactory_1.default());
this.workspaceFetcher = workspaceFetcher;

@@ -49,3 +50,3 @@ this.eventProcessor = eventProcessor;

}
var evaluation = this.evaluator.evaluate(experiment, user, defaultVariation);
var evaluation = this.evaluator.evaluate(workspace, experiment, user, hackleProperties, defaultVariation);
this.eventProcessor.process(Event_1.default.exposure(experiment, user, evaluation, hackleProperties));

@@ -77,5 +78,5 @@ return model_1.Decision.of(evaluation.variationKey, evaluation.reason);

log.warn("FeatureFlag does not exist.");
return model_1.FeatureFlagDecision.off(model_1.DecisionReason.EXPERIMENT_NOT_FOUND);
return model_1.FeatureFlagDecision.off(model_1.DecisionReason.FEATURE_FLAG_NOT_FOUND);
}
var evaluation = this.evaluator.evaluate(featureFlag, user, "A");
var evaluation = this.evaluator.evaluate(workspace, featureFlag, user, hackleProperties, "A");
this.eventProcessor.process(Event_1.default.exposure(featureFlag, user, evaluation, hackleProperties));

@@ -82,0 +83,0 @@ if (evaluation.variationKey === "A") {

@@ -1,2 +0,4 @@

import { DecisionReason, Experiment, User, Variation, VariationId, VariationKey } from "../model/model";
import { DecisionReason, Experiment, Properties, User, Variation, VariationId, VariationKey } from "../model/model";
import EvaluationFlowFactory from "./flow/EvaluationFlowFactory";
import Workspace from "../workspace/Workspace";
export declare class Evaluation {

@@ -7,10 +9,11 @@ variationId: VariationId | undefined;

constructor(variationId: VariationId | undefined, variationKey: VariationKey, reason: DecisionReason);
static withVariation(reason: DecisionReason, variation: Variation): Evaluation;
static withKey(reason: DecisionReason, variationKey: VariationKey): Evaluation;
static withVariation(variation: Variation, reason: DecisionReason): Evaluation;
static withKey(variationKey: VariationKey, reason: DecisionReason): Evaluation;
static of(experiment: Experiment, variationKey: VariationKey, reason: DecisionReason): Evaluation;
}
export default class Evaluator {
private bucketer;
evaluate(experiment: Experiment, user: User, defaultVariationKey: VariationKey): Evaluation;
private _evaluate;
private evaluationFlowFactory;
constructor(evaluationFlowFactory: EvaluationFlowFactory);
evaluate(workspace: Workspace, experiment: Experiment, user: User, hackleProperties: Properties, defaultVariationKey: VariationKey): Evaluation;
}
//# sourceMappingURL=Evaluator.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Evaluation = void 0;
var Bucketer_1 = require("./Bucketer");
var model_1 = require("../model/model");
var Evaluation = /** @class */ (function () {

@@ -12,8 +10,17 @@ function Evaluation(variationId, variationKey, reason) {

}
Evaluation.withVariation = function (reason, variation) {
Evaluation.withVariation = function (variation, reason) {
return new Evaluation(variation.id, variation.key, reason);
};
Evaluation.withKey = function (reason, variationKey) {
Evaluation.withKey = function (variationKey, reason) {
return new Evaluation(undefined, variationKey, reason);
};
Evaluation.of = function (experiment, variationKey, reason) {
var variation = experiment._getVariationByKeyOrNull(variationKey);
if (variation) {
return Evaluation.withVariation(variation, reason);
}
else {
return Evaluation.withKey(variationKey, reason);
}
};
return Evaluation;

@@ -23,41 +30,9 @@ }());

var Evaluator = /** @class */ (function () {
function Evaluator() {
this.bucketer = new Bucketer_1.default();
function Evaluator(evaluationFlowFactory) {
this.evaluationFlowFactory = evaluationFlowFactory;
}
Evaluator.prototype.evaluate = function (experiment, user, defaultVariationKey) {
var overriddenVariation = experiment.getOverriddenVariation(user);
if (overriddenVariation) {
return Evaluation.withKey(model_1.DecisionReason.OVERRIDDEN, overriddenVariation.key);
}
if (experiment instanceof model_1.Experiment.Draft) {
return Evaluation.withKey(model_1.DecisionReason.EXPERIMENT_DRAFT, defaultVariationKey);
}
if (experiment instanceof model_1.Experiment.Running) {
return this._evaluate(experiment, user, defaultVariationKey);
}
if (experiment instanceof model_1.Experiment.Paused) {
return Evaluation.withKey(model_1.DecisionReason.EXPERIMENT_PAUSED, defaultVariationKey);
}
if (experiment instanceof model_1.Experiment.Completed) {
return Evaluation.withKey(model_1.DecisionReason.EXPERIMENT_COMPLETED, experiment.winnerVariationKey);
}
throw new Error("Unsupported experiment");
Evaluator.prototype.evaluate = function (workspace, experiment, user, hackleProperties, defaultVariationKey) {
var evaluationFlow = this.evaluationFlowFactory.getFlow(experiment.type);
return evaluationFlow.evaluate(workspace, experiment, user, hackleProperties, defaultVariationKey);
};
Evaluator.prototype._evaluate = function (experiment, user, defaultVariationKey) {
if (experiment instanceof model_1.Experiment.Running) {
var allocatedSlot = this.bucketer.bucketing(experiment.bucket, user);
if (!allocatedSlot) {
return Evaluation.withKey(model_1.DecisionReason.TRAFFIC_NOT_ALLOCATED, defaultVariationKey);
}
var allocatedVariation = experiment.getVariation(allocatedSlot.variationId);
if (!allocatedVariation) {
return Evaluation.withKey(model_1.DecisionReason.TRAFFIC_NOT_ALLOCATED, defaultVariationKey);
}
if (allocatedVariation.isDropped) {
return Evaluation.withKey(model_1.DecisionReason.VARIATION_DROPPED, defaultVariationKey);
}
return Evaluation.withVariation(model_1.DecisionReason.TRAFFIC_ALLOCATED, allocatedVariation);
}
throw new Error("Unsupported experiment");
};
return Evaluator;

@@ -64,0 +39,0 @@ }());

@@ -68,3 +68,3 @@ "use strict";

userId: this.user.id,
userProperties: this.user.properties || {},
userProperties: PropertyUtil_1.default.filteredProperties(this.user.properties || {}),
eventTypeId: this.eventType.id,

@@ -71,0 +71,0 @@ eventTypeKey: this.eventType.key,

@@ -41,2 +41,10 @@ export declare type Int = number;

/**
* Indicates that the variation could not be decided due to an unexpected exception.
*/
static EXCEPTION: string;
/**
* Indicates that the input value is invalid.
*/
static INVALID_INPUT: string;
/**
* Indicates that no experiment was found for the experiment key provided by the caller.

@@ -74,9 +82,25 @@ */

/**
* Indicates that the variation could not be decided due to an unexpected exception.
* Indicates that the user is not the target of the experiment.
*/
static EXCEPTION: string;
static NOT_IN_EXPERIMENT_TARGET: string;
/**
* Indicates that the input value is invalid.
* Indicates that no feature flag was found for the feature key provided by the caller.
*/
static INVALID_INPUT: string;
static FEATURE_FLAG_NOT_FOUND: string;
/**
* Indicates that the feature flag is inactive.
*/
static FEATURE_FLAG_INACTIVE: string;
/**
* Indicates that the user is matched to the individual target of the feature flag.
*/
static INDIVIDUAL_TARGET_MATCH: string;
/**
* Indicates that the user is matched to the target rule of the feature flag.
*/
static TARGET_RULE_MATCH: string;
/**
* Indicates that the user did not match any individual targets or target rules.
*/
static DEFAULT_RULE: string;
}

@@ -88,26 +112,30 @@ export declare type ExperimentType = "AB_TEST" | "FEATURE_FLAG";

type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
constructor(id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides);
variations: Variation[];
overrides: Map<UserId, VariationId>;
constructor(id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>);
static Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -117,10 +145,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -131,11 +160,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -149,11 +180,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -163,10 +196,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -182,22 +216,26 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -208,11 +246,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -227,23 +267,28 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -260,23 +305,28 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -286,10 +336,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -304,22 +355,26 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -338,21 +393,25 @@ Draft: any;

static Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -362,10 +421,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -376,11 +436,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -394,11 +456,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -408,10 +472,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -428,20 +493,22 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -452,11 +519,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -472,21 +541,24 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -504,21 +576,24 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -528,10 +603,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -547,20 +623,22 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -580,32 +658,37 @@ Draft: any;

static Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -616,11 +699,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -635,23 +720,28 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -668,21 +758,25 @@ Draft: any;

Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -693,11 +787,13 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -713,21 +809,24 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -746,33 +845,39 @@ Draft: any;

Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -788,21 +893,25 @@ Draft: any;

Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -823,33 +932,39 @@ Draft: any;

static Completed: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides, _winnerVariationId: Long): {
winnerVariationKey: VariationKey;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, _winnerVariationId: VariationId): {
_winnerVariationId: VariationId;
winnerVariation(): Variation;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -859,10 +974,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -877,22 +993,26 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -910,21 +1030,25 @@ Draft: any;

Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -934,10 +1058,11 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -953,20 +1078,22 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -985,32 +1112,37 @@ Draft: any;

Paused: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: any;
Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -1026,21 +1158,25 @@ Draft: any;

Running: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, bucket: Bucket, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
bucket: Bucket;
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>, targetAudiences: Target[], targetRules: TargetRule[], defaultRule: TargetAction): {
targetAudiences: Target[];
targetRules: TargetRule[];
defaultRule: TargetAction;
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};
Draft: {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Map<VariationId, Variation>, overrides: UserOverrides): {
new (id: ExperimentId, key: ExperimentKey, type: ExperimentType, variations: Variation[], overrides: Map<UserId, VariationId>): {
id: ExperimentId;
key: ExperimentKey;
type: ExperimentType;
variations: Map<VariationId, Variation>;
overrides: UserOverrides;
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
variations: Variation[];
overrides: Map<UserId, VariationId>;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
};

@@ -1061,4 +1197,5 @@ Draft: any;

};
getVariation(variationId: VariationId): Variation | undefined;
getOverriddenVariation(user: User): Variation | undefined;
_getVariationByIdOrNull(variationId: VariationId): Variation | undefined;
_getVariationByKeyOrNull(variationKey: VariationKey): Variation | undefined;
_getOverriddenVariation(user: User): Variation | undefined;
}

@@ -1071,7 +1208,2 @@ export declare class Variation {

}
export declare class UserOverrides {
private overrides;
constructor(overrides: Map<UserId, Variation>);
get(userId: UserId): Variation | undefined;
}
export declare class Bucket {

@@ -1108,2 +1240,44 @@ seed: number;

}
export declare class Target {
conditions: TargetCondition[];
constructor(conditions: TargetCondition[]);
}
export declare class TargetCondition {
key: TargetKey;
match: TargetMatch;
constructor(key: TargetKey, match: TargetMatch);
}
export declare class TargetKey {
type: TargetKeyType;
name: string;
constructor(type: TargetKeyType, name: string);
}
export declare class TargetMatch {
type: MatchType;
operator: MatchOperator;
valueType: MatchValueType;
values: any[];
constructor(type: MatchType, operator: MatchOperator, valueType: MatchValueType, values: any[]);
}
export declare class TargetAction {
type: TargetActionType;
variationId: number | undefined;
bucketId: number | undefined;
constructor(type: TargetActionType, variationId: number | undefined, bucketId: number | undefined);
}
export declare class TargetRule {
target: Target;
action: TargetAction;
constructor(target: Target, action: TargetAction);
}
export declare const MATCH_TYPES: readonly ["MATCH", "NOT_MATCH"];
export declare const MATCH_VALUE_TYPES: readonly ["STRING", "NUMBER", "BOOLEAN"];
export declare const MATCH_OPERATORS: readonly ["IN", "CONTAINS", "STARTS_WITH", "ENDS_WITH", "GT", "GTE", "LT", "LTE"];
export declare const TARGET_ACTION_TYPES: readonly ["VARIATION", "BUCKET"];
export declare const TARGET_KEY_TYPES: readonly ["HACKLE_PROPERTY", "USER_PROPERTY"];
export declare type MatchType = typeof MATCH_TYPES[number];
export declare type MatchValueType = typeof MATCH_VALUE_TYPES[number];
export declare type MatchOperator = typeof MATCH_OPERATORS[number];
export declare type TargetActionType = typeof TARGET_ACTION_TYPES[number];
export declare type TargetKeyType = typeof TARGET_KEY_TYPES[number];
//# sourceMappingURL=model.d.ts.map
"use strict";
// import {VariationKey} from "../VariationKey"
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventType = exports.Slot = exports.Bucket = exports.UserOverrides = exports.Variation = exports.Experiment = exports.DecisionReason = exports.FeatureFlagDecision = exports.Decision = void 0;
exports.TARGET_KEY_TYPES = exports.TARGET_ACTION_TYPES = exports.MATCH_OPERATORS = exports.MATCH_VALUE_TYPES = exports.MATCH_TYPES = exports.TargetRule = exports.TargetAction = exports.TargetMatch = exports.TargetKey = exports.TargetCondition = exports.Target = exports.EventType = exports.Slot = exports.Bucket = exports.Variation = exports.Experiment = exports.DecisionReason = exports.FeatureFlagDecision = exports.Decision = void 0;
var tslib_1 = require("tslib");

@@ -47,2 +48,10 @@ /**

/**
* Indicates that the variation could not be decided due to an unexpected exception.
*/
DecisionReason.EXCEPTION = "EXCEPTION";
/**
* Indicates that the input value is invalid.
*/
DecisionReason.INVALID_INPUT = "INVALID_INPUT";
/**
* Indicates that no experiment was found for the experiment key provided by the caller.

@@ -80,9 +89,25 @@ */

/**
* Indicates that the variation could not be decided due to an unexpected exception.
* Indicates that the user is not the target of the experiment.
*/
DecisionReason.EXCEPTION = "EXCEPTION";
DecisionReason.NOT_IN_EXPERIMENT_TARGET = "NOT_IN_EXPERIMENT_TARGET";
/**
* Indicates that the input value is invalid.
* Indicates that no feature flag was found for the feature key provided by the caller.
*/
DecisionReason.INVALID_INPUT = "INVALID_INPUT";
DecisionReason.FEATURE_FLAG_NOT_FOUND = "FEATURE_FLAG_NOT_FOUND";
/**
* Indicates that the feature flag is inactive.
*/
DecisionReason.FEATURE_FLAG_INACTIVE = "FEATURE_FLAG_INACTIVE";
/**
* Indicates that the user is matched to the individual target of the feature flag.
*/
DecisionReason.INDIVIDUAL_TARGET_MATCH = "INDIVIDUAL_TARGET_MATCH";
/**
* Indicates that the user is matched to the target rule of the feature flag.
*/
DecisionReason.TARGET_RULE_MATCH = "TARGET_RULE_MATCH";
/**
* Indicates that the user did not match any individual targets or target rules.
*/
DecisionReason.DEFAULT_RULE = "DEFAULT_RULE";
return DecisionReason;

@@ -99,9 +124,17 @@ }());

}
Experiment.prototype.getVariation = function (variationId) {
return this.variations.get(variationId);
Experiment.prototype._getVariationByIdOrNull = function (variationId) {
return this.variations.find(function (it) { return it.id === variationId; });
};
Experiment.prototype.getOverriddenVariation = function (user) {
var overriddenVariation = this.overrides.get(user.id);
return overriddenVariation && this.getVariation(overriddenVariation.id);
Experiment.prototype._getVariationByKeyOrNull = function (variationKey) {
return this.variations.find(function (it) { return it.key === variationKey; });
};
Experiment.prototype._getOverriddenVariation = function (user) {
var overriddenVariationId = this.overrides.get(user.id);
if (overriddenVariationId) {
return this._getVariationByIdOrNull(overriddenVariationId);
}
else {
return undefined;
}
};
Experiment.Draft = /** @class */ (function (_super) {

@@ -116,5 +149,7 @@ tslib_1.__extends(Draft, _super);

tslib_1.__extends(Running, _super);
function Running(id, key, type, bucket, variations, overrides) {
function Running(id, key, type, variations, overrides, targetAudiences, targetRules, defaultRule) {
var _this = _super.call(this, id, key, type, variations, overrides) || this;
_this.bucket = bucket;
_this.targetAudiences = targetAudiences;
_this.targetRules = targetRules;
_this.defaultRule = defaultRule;
return _this;

@@ -134,7 +169,10 @@ }

function Completed(id, key, type, variations, overrides, _winnerVariationId) {
var _a;
var _this = _super.call(this, id, key, type, variations, overrides) || this;
_this.winnerVariationKey = (_a = variations.get(_winnerVariationId)) === null || _a === void 0 ? void 0 : _a.key;
_this._winnerVariationId = _winnerVariationId;
return _this;
}
Completed.prototype.winnerVariation = function () {
var _this = this;
return this.variations.find(function (it) { return it.id === _this._winnerVariationId; });
};
return Completed;

@@ -154,12 +192,2 @@ }(Experiment));

exports.Variation = Variation;
var UserOverrides = /** @class */ (function () {
function UserOverrides(overrides) {
this.overrides = overrides;
}
UserOverrides.prototype.get = function (userId) {
return this.overrides.get(userId);
};
return UserOverrides;
}());
exports.UserOverrides = UserOverrides;
var Bucket = /** @class */ (function () {

@@ -194,2 +222,57 @@ function Bucket(seed, slotSize, slots) {

exports.EventType = EventType;
var Target = /** @class */ (function () {
function Target(conditions) {
this.conditions = conditions;
}
return Target;
}());
exports.Target = Target;
var TargetCondition = /** @class */ (function () {
function TargetCondition(key, match) {
this.key = key;
this.match = match;
}
return TargetCondition;
}());
exports.TargetCondition = TargetCondition;
var TargetKey = /** @class */ (function () {
function TargetKey(type, name) {
this.type = type;
this.name = name;
}
return TargetKey;
}());
exports.TargetKey = TargetKey;
var TargetMatch = /** @class */ (function () {
function TargetMatch(type, operator, valueType, values) {
this.type = type;
this.operator = operator;
this.valueType = valueType;
this.values = values;
}
return TargetMatch;
}());
exports.TargetMatch = TargetMatch;
var TargetAction = /** @class */ (function () {
function TargetAction(type, variationId, bucketId) {
this.type = type;
this.variationId = variationId;
this.bucketId = bucketId;
}
return TargetAction;
}());
exports.TargetAction = TargetAction;
var TargetRule = /** @class */ (function () {
function TargetRule(target, action) {
this.target = target;
this.action = action;
}
return TargetRule;
}());
exports.TargetRule = TargetRule;
exports.MATCH_TYPES = ["MATCH", "NOT_MATCH"];
exports.MATCH_VALUE_TYPES = ["STRING", "NUMBER", "BOOLEAN"];
exports.MATCH_OPERATORS = ["IN", "CONTAINS", "STARTS_WITH", "ENDS_WITH", "GT", "GTE", "LT", "LTE"];
exports.TARGET_ACTION_TYPES = ["VARIATION", "BUCKET"];
exports.TARGET_KEY_TYPES = ["HACKLE_PROPERTY", "USER_PROPERTY"];
//# sourceMappingURL=model.js.map

@@ -25,2 +25,5 @@ import { List, Long } from "../model/model";

userOverrides: List<UserOverrideDto>;
targetAudiences: List<TargetDto>;
targetRules: List<TargetRuleDto>;
defaultRule: TargetActionDto;
}

@@ -46,2 +49,28 @@ export interface UserOverrideDto {

}
export interface TargetDto {
conditions: List<TargetConditionDto>;
}
export interface TargetConditionDto {
key: TargetKeyDto;
match: TargetMatchDto;
}
export interface TargetKeyDto {
type: string;
name: string;
}
export interface TargetMatchDto {
type: string;
operator: string;
valueType: string;
values: List<any>;
}
export interface TargetActionDto {
type: string;
variationId?: number;
bucketId?: number;
}
export interface TargetRuleDto {
target: TargetDto;
action: TargetActionDto;
}
//# sourceMappingURL=dto.d.ts.map

@@ -1,2 +0,2 @@

import { EventKey, EventType, Experiment, ExperimentKey } from "../model/model";
import { Bucket, BucketId, EventKey, EventType, Experiment, ExperimentKey } from "../model/model";
import { WorkspaceDto } from "./dto";

@@ -6,9 +6,28 @@ export default class Workspace {

private featureFlags;
private buckets;
private eventTypes;
constructor(experiments: Map<ExperimentKey, Experiment>, featureFlags: Map<ExperimentKey, Experiment>, eventTypes: Map<EventKey, EventType>);
constructor(experiments: Map<ExperimentKey, Experiment>, featureFlags: Map<ExperimentKey, Experiment>, buckets: Map<BucketId, Bucket>, eventTypes: Map<EventKey, EventType>);
getExperimentOrNull(experimentKey: ExperimentKey): Experiment | undefined;
getFeatureFlagOrNull(featureKey: ExperimentKey): Experiment | undefined;
getBucketOrNull(bucketId: BucketId): Bucket | undefined;
getEventTypeOrNull(eventKey: EventKey): EventType;
static from(dto: WorkspaceDto): Workspace;
private static toBucket;
private static toExperimentOrNull;
private static toTargetRuleOrNull;
private static toTargetActionOrNull;
private static toTargetOrNull;
private static toConditionOrNull;
private static toTargetKeyOrNull;
private static toTargetMatchOrNull;
private static parseOrNull;
}
declare global {
interface Array<T> {
mapNotUndefined<R>(this: T[], transform: (value: T) => R | undefined): Array<R>;
associateTo<K, V>(this: T[], destination: Map<K, V>, transform: (value: T) => [K, V]): Map<K, V>;
associate<K, V>(this: T[], transform: (value: T) => [K, V]): Map<K, V>;
associateBy<K>(this: T[], keySelector: (value: T) => K): Map<K, T>;
}
}
//# sourceMappingURL=Workspace.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var model_1 = require("../model/model");
var logger_1 = require("../logger");
var log = logger_1.default.log;
var Workspace = /** @class */ (function () {
function Workspace(experiments, featureFlags, eventTypes) {
function Workspace(experiments, featureFlags, buckets, eventTypes) {
this.experiments = experiments;
this.featureFlags = featureFlags;
this.buckets = buckets;
this.eventTypes = eventTypes;

@@ -16,2 +19,5 @@ }

};
Workspace.prototype.getBucketOrNull = function (bucketId) {
return this.buckets.get(bucketId);
};
Workspace.prototype.getEventTypeOrNull = function (eventKey) {

@@ -27,48 +33,102 @@ var eventType = this.eventTypes.get(eventKey);

Workspace.from = function (dto) {
var buckets = dto.buckets.reduce(function (m, it) {
m.set(it.id, new model_1.Bucket(it.seed, it.slotSize, it.slots.map(function (_a) {
var startInclusive = _a.startInclusive, endExclusive = _a.endExclusive, variationId = _a.variationId;
return new model_1.Slot(startInclusive, endExclusive, variationId);
})));
return m;
}, new Map());
var experiment = dto.experiments.reduce(function (m, it) {
m.set(it.key, experimentDtoToExperiment.call(it, "AB_TEST", buckets.get(it.bucketId)));
return m;
}, new Map());
var featureFlags = dto.featureFlags.reduce(function (m, it) {
m.set(it.key, experimentDtoToExperiment.call(it, "FEATURE_FLAG", buckets.get(it.bucketId)));
return m;
}, new Map());
var eventTypes = dto.events.reduce(function (m, it) {
m.set(it.key, new model_1.EventType(it.id, it.key));
return m;
}, new Map());
return new Workspace(new Map(experiment), new Map(featureFlags), eventTypes);
var _this = this;
var buckets = dto.buckets.associate(function (it) { return [it.id, _this.toBucket(it)]; });
var experiments = dto.experiments
.mapNotUndefined(function (it) { return _this.toExperimentOrNull("AB_TEST", it); })
.associateBy(function (it) { return it.key; });
var featureFlags = dto.featureFlags
.mapNotUndefined(function (it) { return _this.toExperimentOrNull("FEATURE_FLAG", it); })
.associateBy(function (it) { return it.key; });
var eventTypes = dto.events.associate(function (it) { return [it.key, new model_1.EventType(it.id, it.key)]; });
return new Workspace(experiments, featureFlags, buckets, eventTypes);
};
Workspace.toBucket = function (dto) {
return new model_1.Bucket(dto.seed, dto.slotSize, dto.slots.map(function (_a) {
var startInclusive = _a.startInclusive, endExclusive = _a.endExclusive, variationId = _a.variationId;
return new model_1.Slot(startInclusive, endExclusive, variationId);
}));
};
Workspace.toExperimentOrNull = function (type, dto) {
var _this = this;
var variations = dto.variations.map(function (it) { return new model_1.Variation(it.id, it.key, it.status === "DROPPED"); });
var overrides = dto.execution.userOverrides.associate(function (it) { return [it.userId, it.variationId]; });
switch (dto.execution.status) {
case "READY":
return new model_1.Experiment.Draft(dto.id, dto.key, type, variations, overrides);
case "RUNNING":
var targetAudiences = dto.execution.targetAudiences.mapNotUndefined(function (it) { return _this.toTargetOrNull(it); });
var targetRules = dto.execution.targetRules.mapNotUndefined(function (it) { return _this.toTargetRuleOrNull(it); });
var defaultRule = this.toTargetActionOrNull(dto.execution.defaultRule);
return defaultRule &&
new model_1.Experiment.Running(dto.id, dto.key, type, variations, overrides, targetAudiences, targetRules, defaultRule);
case "PAUSED":
return new model_1.Experiment.Paused(dto.id, dto.key, type, variations, overrides);
case "STOPPED":
return new model_1.Experiment.Completed(dto.id, dto.key, type, variations, overrides, dto.winnerVariationId);
default:
return undefined;
}
};
Workspace.toTargetRuleOrNull = function (dto) {
var target = this.toTargetOrNull(dto.target);
var action = this.toTargetActionOrNull(dto.action);
return target && action && new model_1.TargetRule(target, action);
};
Workspace.toTargetActionOrNull = function (dto) {
var type = this.parseOrNull(model_1.TARGET_ACTION_TYPES, dto.type);
return type && new model_1.TargetAction(type, dto.variationId, dto.bucketId);
};
Workspace.toTargetOrNull = function (dto) {
var _this = this;
var conditions = dto.conditions
.mapNotUndefined(function (it) { return _this.toConditionOrNull(it); });
return new model_1.Target(conditions);
};
Workspace.toConditionOrNull = function (dto) {
var key = this.toTargetKeyOrNull(dto.key);
var match = this.toTargetMatchOrNull(dto.match);
return key && match && new model_1.TargetCondition(key, match);
};
Workspace.toTargetKeyOrNull = function (dto) {
var keyType = this.parseOrNull(model_1.TARGET_KEY_TYPES, dto.type);
return keyType && new model_1.TargetKey(keyType, dto.name);
};
Workspace.toTargetMatchOrNull = function (dto) {
var matchType = this.parseOrNull(model_1.MATCH_TYPES, dto.type);
var operator = this.parseOrNull(model_1.MATCH_OPERATORS, dto.operator);
var valueType = this.parseOrNull(model_1.MATCH_VALUE_TYPES, dto.valueType);
return matchType && operator && valueType && new model_1.TargetMatch(matchType, operator, valueType, dto.values);
};
Workspace.parseOrNull = function (types, type) {
var t = types.find(function (it) { return it === type; });
if (!t) {
log.debug("Unsupported type [" + t + "]. Please use the latest version of sdk.");
}
return t;
};
return Workspace;
}());
exports.default = Workspace;
function experimentDtoToExperiment(type, bucket) {
var variations = this.variations.reduce(function (m, it) {
m.set(it.id, new model_1.Variation(it.id, it.key, it.status === "DROPPED"));
return m;
}, new Map());
var overrides = new model_1.UserOverrides(this.execution.userOverrides.reduce(function (m, it) {
m.set(it.userId, variations.get(it.variationId));
return m;
}, new Map()));
switch (this.execution.status) {
case "READY":
return new model_1.Experiment.Draft(this.id, this.key, type, variations, overrides);
case "RUNNING":
return new model_1.Experiment.Running(this.id, this.key, type, bucket, variations, overrides);
case "PAUSED":
return new model_1.Experiment.Paused(this.id, this.key, type, variations, overrides);
case "STOPPED":
return new model_1.Experiment.Completed(this.id, this.key, type, variations, overrides, this.winnerVariationId);
default:
return undefined;
}
}
Array.prototype.mapNotUndefined = function (transform) {
return this.reduce(function (results, t) {
var result = transform(t);
if (result) {
results.push(result);
}
return results;
}, Array());
};
Array.prototype.associateTo = function (destination, transform) {
return this.reduce(function (map, value) {
var kv = transform(value);
map.set(kv[0], kv[1]);
return map;
}, destination);
};
Array.prototype.associate = function (transform) {
return this.associateTo(new Map(), transform);
};
Array.prototype.associateBy = function (keySelector) {
return this.associateTo(new Map(), function (it) { return [keySelector(it), it]; });
};
//# sourceMappingURL=Workspace.js.map
{
"name": "@hackler/sdk-core",
"version": "2.0.0",
"version": "2.1.0",
"description": "JavaScript SDK-core",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc